Browse Source

Fix warnings in ctkPopupWidget

Unused variable
Parenthesis between && and ||
Julien Finet 14 years ago
parent
commit
358ca237c7

+ 1 - 1
Libs/Widgets/Testing/Cpp/ctkPopupWidgetTest1.cpp

@@ -177,7 +177,7 @@ int ctkPopupWidgetTest1(int argc, char * argv [] )
   base.show();
   
   QList<ctkPopupWidget*> popups;
-  QWidget* hiddenPanel = createPanel("Hidden", popups);
+  createPanel("Hidden", popups); //create a panel that is hidden (never shown)
   QWidget* scrollPanel = createPanel("Scroll", popups);
   foreach(ctkPopupWidget* popup, popups)
     {

+ 6 - 3
Libs/Widgets/ctkPopupWidget.cpp

@@ -471,10 +471,13 @@ void ctkPopupWidgetPrivate::updateVisibility()
   // If the BaseWidget window is active, then there is no reason to cover the
   // popup.
   if (!this->BaseWidget  ||
+      // the popupwidget active window is not active
       (!this->BaseWidget->window()->isActiveWindow() &&
-       !qApp->activeWindow() ||
-       (qApp->activeWindow()->windowType() != Qt::ToolTip &&
-        qApp->activeWindow()->windowType() != Qt::Popup)))
+      // and no other active window
+       (!qApp->activeWindow() ||
+      // or the active window is a popup/tooltip
+        (qApp->activeWindow()->windowType() != Qt::ToolTip &&
+         qApp->activeWindow()->windowType() != Qt::Popup))))
     {
     foreach(QWidget* topLevelWidget, qApp->topLevelWidgets())
       {