Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110127

Fix broken QApplication::setOverrideCursor (mainly in Qt7, but maybe before)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.5.0 Beta1
    • GUI: Other
    • 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))

      { removeTopIndexFromRemovedOverrideCursorIndexes(); doAnotherStackPopAndGetNewTopIndex(); }

      Still pretty simple.

      I made it bug though it strictly is an improvement, but it is a very needed improvement.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tmartsum Thorbjørn Lund Martsum
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes