]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Avoid sorting too frequently
authorFelix Ernst <felixernst@zohomail.eu>
Thu, 4 Jan 2024 17:16:47 +0000 (18:16 +0100)
committerFelix Ernst <felixernst@kde.org>
Mon, 22 Jan 2024 13:45:01 +0000 (13:45 +0000)
d98037745fe6b5efbe9b145da7d20fa2f731b6a6 changed the time from 500 ms to
50 ms. This commit changes it to 100 ms.

Information relevant for sorting might change repeatedly. Prior to this
commit here we would resort within 50 ms of sorting being requested. If a
lot of resorts would be requested in a short time frame, this could lead
to the item order changing within the view up to 20 times a second which
would lead to a lot of unnecessary movement and make it impossible to
read even file names during the repeated sorting.

100 ms is half as bad in that regard. Bigger values might be even better
    but it is a trade-off.

src/kitemviews/kfileitemmodel.cpp

index 939f66157da6c34a0c0b90d8623676f1126850d9..81c3be64050a7f89d402a7e8f1b0102990de04e6 100644 (file)
@@ -99,7 +99,8 @@ KFileItemModel::KFileItemModel(QObject *parent)
     // for a lot of items within a quite small timeslot. To prevent expensive resortings the
     // resorting is postponed until the timer has been exceeded.
     m_resortAllItemsTimer = new QTimer(this);
-    m_resortAllItemsTimer->setInterval(50);
+    m_resortAllItemsTimer->setInterval(100); // 100 is a middle ground between sorting too frequently which makes the view unreadable
+                                             // and sorting too infrequently which leads to users seeing an outdated sort order.
     m_resortAllItemsTimer->setSingleShot(true);
     connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems);