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

QToolTip causes window state bugs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.6, 5.7, 5.8
    • None

      [I reproduced this on Windows, but have not tested other platforms]

      Showing a tooltip can raise its parent window, taking the topmost window away from the user.

      With the testcase below:

      1. Start with the 'other widget' partially obscuring the 'tooltip widget'.
      2. Click the 'other widget'.
      3. Move the mouse onto the 'tooltip widget'

      Result: The 'tooltip widget' is raised, partially or fully obscuring the 'other widget'. However, the 'other widget' is still treated by the windowing system as active. Clicking on the 'other widget' now does not raise it above the 'tooltip widget'.

      #include <QApplication>
      
      #include <QEnterEvent>
      #include <QToolTip>
      
      class MyWidget : public QWidget
      {
          Q_OBJECT
      public:
          void enterEvent(QEvent *event) override
          {
              QToolTip::showText(static_cast<QEnterEvent*>(event)->screenPos().toPoint(), "This is the message", this);
              QWidget::enterEvent(event);
          }
      };
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
      
          QWidget otherWidget;
          otherWidget.setWindowTitle("Other widget");
          otherWidget.show();
          otherWidget.resize(300, 300);
      
          MyWidget mw;
          mw.setWindowTitle("Tooltip widget");
          mw.show();
      
          return app.exec();
      }
      
      #include "tooltip.moc"
      

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            stkellyms Stephen Kelly (Work)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes