From 65eefdce67e8c7bea6156e7f52f293f2cc09a140 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Thu, 4 Jan 2024 18:16:47 +0100 Subject: [PATCH] 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. --- src/kitemviews/kfileitemmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.47.3