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

[mac] qcursor not updated when entering a Window

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Incomplete
    • Affects Version/s: 5.6.2
    • Fix Version/s: None
    • Component/s: Widgets: Main Window
    • Labels:
      None
    • Environment:
      Mac OS X.11
    • Platform/s:
      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
          Nicolas Castagne
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              castagne Nicolas Castagne
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes