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

QFrame does not emit leave event when opening dialog from mouseReleaseEvent() when used in popup (menu widget)

    XMLWordPrintable

Details

    Description

      QFrame should emit leave event during mouseReleaseEvent() in order that the hover effect can be removed.

      Test program attached. Notable code shown below.

      void DraftMenuButton::mouseReleaseEvent( QMouseEvent *event )
      {
          Q_UNUSED(event);
      
          QMessageBox draftMessageBox;
          draftMessageBox.setText("Click OK to close me.");
          draftMessageBox.exec();
      
          // Hover highlight stays in Qt 5, but not reproducible on Qt 4 environment.
          //QTimer::singleShot(0, dialog, SLOT(exec()));
          //QFocusFrame::mouseReleaseEvent(event);
      
      #if USE_WORKAROUND
          // Workaround for Qt 5 environment.
          // The hover state is reset after a leave event sent.
          QEvent e(QEvent::Leave);
          QApplication::sendEvent(this, &e);
      #endif
      }
      

      Hover highlight stays in Qt 5, but not reproducible on Qt 4 environment.

      Attachments

        1. framehovertest_v1.png
          framehovertest_v1.png
          17 kB
        2. framehovertest_v1.zip
          4 kB
        3. qtbug38021.zip
          2 kB

        Issue Links

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

          Activity

            People

              jolind Jorgen Lind
              leonlee Leonard Lee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes