Pārlūkot izejas kodu

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 14 gadi atpakaļ
vecāks
revīzija
6864b2a2b1
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  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();