Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.0 Beta1
-
None
Description
The problem with the current system is that we expect push and pop operations to happen synchronized and that nothing similar happens when other events are triggered, but that does not support how many programs work. In real life a wrong restore order leaves the program with a wrong cursor.
What we really should have is:
qint64 QGuiApplication::setOverrideCursor(cursor); // returning an id (>=0) to the cursor set
QGuiApplication::restoreOverrideCursor(qint64 id = -1); // removes the cursor with the specified id (or the top one if not specified).
Maybe some functionality can be improved in Qt 6.x, but it will require an overload of setOverrideCursor with an extra parameter.
Regarding implementation I thought about water-marking the cursors when removed and that could work, but currently I fail to see a way to store some simple information on the cursor.
Alternatively we can however have a
QSet<int> removedOverrideCursorIndexes;
So when we pop we first check if it is the stack top one - if it isn't we just insert the index in removedOverrideCursorIndexes and return. If it is the top one we do an initial pop followed by
while (removedOverrideCursorIndexes.contains(topIndex))
Still pretty simple.
I made it bug though it strictly is an improvement, but it is a very needed improvement.