┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-01-04 18:16:47 +0100
committerFelix Ernst <[email protected]>2024-01-22 13:45:01 +0000
commit65eefdce67e8c7bea6156e7f52f293f2cc09a140 (patch)
treedc18db353a60bc9bacacc1769e2878c134828e35
parent7a28bed8ee3c6400abc2cfe8bd1ce67454f4d00a (diff)
Avoid sorting too frequently
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.
-rw-r--r--src/kitemviews/kfileitemmodel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 939f66157..81c3be640 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -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);