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

cursor shape not preserved if child tool window opens (macOS)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2
    • None
    • macOS

    Description

      When a Tool type of window is opened over a widget, then the cursor shape set for this widget is not preserved correctly (cursor reverts to the arrow shape).

      Consider the following code:

      #include <QApplication>
      #include <QWidget>
      
      class Widget : public QWidget
      {
      public:
          Widget(QWidget *parent = nullptr)
          {
              setCursor(Qt::CrossCursor);
          }
      protected:
          void mouseReleaseEvent(QMouseEvent *event) override
          {
              auto dlg = new QWidget(this, Qt::Tool);
              dlg->setAttribute(Qt::WA_DeleteOnClose);
              dlg->setAttribute(Qt::WA_ShowWithoutActivating);
              dlg->show();
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          Widget w;
          w.show();
          return a.exec();
      }
      

      Compile and run this. An empty window will open. It has cross-shaped mouse cursor in it. Click somewhere in the window area. Then a child Tool window get open. If the cursor is out of the area of the opened Tool window but inside the original window, then the cursor will revert from cross-shaped to arrow-shaped cursor. However once the user moves the mouse out of the window area and then move it back, the cross-shaped cursor will be shown again. This happens only on macOS. Has not been observed on Windows. (not tested on Linux yet) It also happens only for Tool type of child. It does not happen for other types (at least not for those which I have tested).

      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
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes