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

[mac] qcursor not updated when entering inactive window

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P3: Somewhat important
    • Resolution: Incomplete
    • 5.6.2, 6.2.0 FF
    • None
    • Widgets: Main Window
    • None
    • Mac OS X.11
    • macOS

    Description

      On the mac, a window which is not the current active window does not get any cursor when the mouse is over : it gets only the basic arrow cursor, event though its current cursor is different.

      Also, calling QApplication::setOverrideCursor(**a cursor** ) from an event handler of an inactive window (e.g. in enterEvent()) does nothing.

      Sample code attached, and copied below.

      #include <QApplication>
      #include <QMainWindow>
      // On the mac, qt5.6, only the currently active window gets the appropriate cursor.
      // Un-activated window only display the arrow cursor.
      // Note that even QApplication::setOverrideCursor(cursor()); fails displaying the correct cursor
      // when entering an unactive window

      class MainWindow : public QMainWindow
      {
      //Q_OBJECT
      protected:
      void enterEvent(QEvent * _e)

      { qDebug() <<"enter event"; QApplication::setOverrideCursor(cursor()); }

      void leaveEvent(QEvent * _event)

      { QApplication::restoreOverrideCursor(); }

      };

      int main(int argc, char *argv[])

      { QApplication app(argc, argv); QMainWindow mainWin1; mainWin1.setWindowTitle("win1"); MainWindow mainWin2; mainWin2.setWindowTitle("win2"); mainWin1.setCursor(Qt::SizeAllCursor); mainWin1.setWindowTitle("win1"); mainWin2.setCursor(Qt::OpenHandCursor); mainWin1.show(); mainWin2.show(); mainWin1.activateWindow(); return app.exec(); }

      Attachments

        1. main.cpp
          1 kB
        2. QTBUG-57772.tgz
          1 kB
        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
            castagne Nicolas Castagne
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes