Quellcode durchsuchen

Reopen the popup when closing, AutoHide and the mouse back

If Autoshow is false but AutoHide true, then leaving the mouse out of the
hot area was closing the popup but was not reopening the popup if the
mouse was back in the area.
Julien Finet vor 13 Jahren
Ursprung
Commit
6864b2a2b1
1 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
  1. 7 1
      Libs/Widgets/ctkPopupWidget.cpp

+ 7 - 1
Libs/Widgets/ctkPopupWidget.cpp

@@ -479,7 +479,13 @@ void ctkPopupWidget::updatePopup()
 
   // Querying mouseOver can be slow, don't do it if not needed.
   QWidget* mouseOver = (d->AutoShow || d->AutoHide) ? d->mouseOver() : 0;
-  if (d->AutoShow && mouseOver &&
+  if ((d->AutoShow ||
+     // Even if there is no AutoShow, we might still want to reopen the popup
+     // when closing it inadvertently
+       d->AutoHide && d->isClosing()) &&
+     // to be automatically open, the mouse has to be over a child widget
+      mouseOver &&
+     // disable opening the popup when the popup is disabled
       (!d->BaseWidget || d->BaseWidget->isEnabled()))
     {
     this->showPopup();