diff options
author | Arno <arno@disconnect.de> | 2016-08-16 18:49:59 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2016-08-16 18:49:59 +0200 |
commit | a5191b5d12791981d16da3b4154b7fb29f1c01db (patch) | |
tree | 56d5534fcc9b1c88e74a1e0c35ca8fc0408435f9 /filesorter.cpp | |
parent | 52a3097986a6e69f57261d74c8807acbe9374c37 (diff) | |
download | ShemovCleaner-a5191b5d12791981d16da3b4154b7fb29f1c01db.tar.gz ShemovCleaner-a5191b5d12791981d16da3b4154b7fb29f1c01db.tar.bz2 ShemovCleaner-a5191b5d12791981d16da3b4154b7fb29f1c01db.zip |
Implement delete files
Thought I did an initial commit, but seems git thinks otherwise...
Diffstat (limited to 'filesorter.cpp')
-rw-r--r-- | filesorter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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); } |