From 54079b4b80af46663590c46109fabeb5cc94a6db Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 2 Jan 2018 23:33:17 +0100 Subject: Sort size numerically, not alphabetically --- filesorter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'filesorter.cpp') diff --git a/filesorter.cpp b/filesorter.cpp index d78b46d..7c6d1d1 100644 --- a/filesorter.cpp +++ b/filesorter.cpp @@ -45,5 +45,12 @@ bool VideoSorter::lessThan(const QModelIndex &source_left, const QModelIndex &so return leftData < rightData; } + //special case for size + if(source_left.column() == FileWidget::SizeColumn){ + qint64 left = source_left.data(FileWidget::SizeRole).toInt(); + qint64 right = source_right.data(FileWidget::SizeRole).toInt(); + return left < right; + } + return QSortFilterProxyModel::lessThan(source_left, source_right); } -- cgit v1.2.3-70-g09d2