From a5191b5d12791981d16da3b4154b7fb29f1c01db Mon Sep 17 00:00:00 2001 From: Arno Date: Tue, 16 Aug 2016 18:49:59 +0200 Subject: Implement delete files Thought I did an initial commit, but seems git thinks otherwise... --- filesorter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'filesorter.cpp') diff --git a/filesorter.cpp b/filesorter.cpp index fc9d1c4..a87ac6f 100644 --- a/filesorter.cpp +++ b/filesorter.cpp @@ -1,6 +1,12 @@ #include "filesorter.h" -FileSorter::FileSorter() -{ +FileSorter::FileSorter(QObject *parent) : QSortFilterProxyModel(parent) {} +bool FileSorter::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { + QVariant leftData = sourceModel()->data(source_left, Qt::UserRole + 1); + QVariant rightData = sourceModel()->data(source_right, Qt::UserRole + 1); + if(leftData.type() == QVariant::Int){ + return leftData.toInt() < rightData.toInt(); + } + return QSortFilterProxyModel::lessThan(source_left, source_right); } -- cgit v1.2.3-70-g09d2