diff options
author | Ezekiel Smith <ezekielsmith@protonmail.com> | 2022-04-20 08:32:38 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-20 08:32:38 +1000 |
commit | 405c44c9e13152dd30383fc09944a3853327cf9a (patch) | |
tree | 909610610abfd744ed8d97df5bad097daab48300 /launcher/minecraft/WorldList.cpp | |
parent | c7563a5f7c00e389b2e2af699ea07d109bfb5ef3 (diff) | |
parent | 27c72935f8a17761e9b18a74643e014cad3587d1 (diff) | |
download | PrismLauncher-405c44c9e13152dd30383fc09944a3853327cf9a.tar.gz PrismLauncher-405c44c9e13152dd30383fc09944a3853327cf9a.tar.bz2 PrismLauncher-405c44c9e13152dd30383fc09944a3853327cf9a.zip |
Merge pull request #462 from Scrumplex/fix-world-size-sort
fix: use size in bytes to sort by world size
Diffstat (limited to 'launcher/minecraft/WorldList.cpp')
-rw-r--r-- | launcher/minecraft/WorldList.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/launcher/minecraft/WorldList.cpp b/launcher/minecraft/WorldList.cpp index 344bea63..955609bf 100644 --- a/launcher/minecraft/WorldList.cpp +++ b/launcher/minecraft/WorldList.cpp @@ -17,6 +17,7 @@ #include "Application.h" #include <FileSystem.h> +#include <Qt> #include <QMimeData> #include <QUrl> #include <QUuid> @@ -190,6 +191,16 @@ QVariant WorldList::data(const QModelIndex &index, int role) const return QVariant(); } + case Qt::UserRole: + switch (column) + { + case SizeColumn: + return qVariantFromValue<qlonglong>(world.bytes()); + + default: + return data(index, Qt::DisplayRole); + } + case Qt::ToolTipRole: { return world.folderName(); @@ -216,7 +227,7 @@ QVariant WorldList::data(const QModelIndex &index, int role) const } case SizeRole: { - return locale.formattedDataSize(world.bytes()); + return qVariantFromValue<qlonglong>(world.bytes()); } case IconFileRole: { |