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

QToolTip causes window state bugs

    XMLWordPrintable

Details

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

    Description

      [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"
      

      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
            stkellyms Stephen Kelly (Work)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes