]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Stop using QVariant < operator
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Wed, 14 Oct 2020 22:07:12 +0000 (00:07 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Wed, 14 Oct 2020 23:22:00 +0000 (01:22 +0200)
It will be removed in Qt 6 without porting strategy:
https://github.com/qt/qtbase/commit/f43cb31ba00a431c6d0a0b17750483a72ae03bb0

We know that that variants will be either ints (for `count`) or longs (for `size`),
so just convert them to longs (to avoid overflows) and compare those.

src/kitemviews/kfileitemmodel.cpp

index a3a2bef32d959c414a00d6a620b7d7b2fa99070f..0b7a5134c4bdf63f5e373b8deb517fbccd92e23f 100644 (file)
@@ -1771,7 +1771,7 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
             } else if (valueB.isNull()) {
                 result = +1;
             } else {
-                if (valueA < valueB) {
+                if (valueA.toLongLong() < valueB.toLongLong()) {
                     return -1;
                 } else {
                     return +1;