From 27c72935f8a17761e9b18a74643e014cad3587d1 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 19 Apr 2022 15:07:14 +0200 Subject: fix: use size in bytes to sort by world size --- launcher/minecraft/WorldList.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'launcher/minecraft/WorldList.cpp') 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 +#include #include #include #include @@ -190,6 +191,16 @@ QVariant WorldList::data(const QModelIndex &index, int role) const return QVariant(); } + case Qt::UserRole: + switch (column) + { + case SizeColumn: + return qVariantFromValue(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(world.bytes()); } case IconFileRole: { -- cgit