1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-04 17:30:55 +00:00

Avoid sorting too frequently

d98037745f 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.
This commit is contained in:
Felix Ernst 2024-01-04 18:16:47 +01:00 committed by Felix Ernst
parent 7a28bed8ee
commit 65eefdce67

View 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);