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

      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.

        1. framehovertest_v1.zip
          4 kB
          Leonard Lee
        2. framehovertest_v1.png
          17 kB
          Leonard Lee
        3. qtbug38021.zip
          2 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes