浏览代码

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 13 年之前
父节点
当前提交
6864b2a2b1
共有 1 个文件被更改,包括 7 次插入1 次删除
  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();