Browse Source

Merge branch 'popup-widget'

* popup-widget:
  ctkPopupWidget::setAutoHide is now a slot
  ctkPopupWidgetPlugin was not allowing more than 1 child
Julien Finet 14 years ago
parent
commit
a9232efefb
2 changed files with 11 additions and 1 deletions
  1. 4 0
      Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp
  2. 7 1
      Libs/Widgets/ctkPopupWidget.h

+ 4 - 0
Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp

@@ -32,7 +32,11 @@ ctkPopupWidgetPlugin::ctkPopupWidgetPlugin(QObject* pluginParent)
 QWidget *ctkPopupWidgetPlugin::createWidget(QWidget* widgetParent)
 {
   ctkPopupWidget* newWidget = new ctkPopupWidget(widgetParent);
+  // if the widget is a tooltip, it wouldn't accept children
   newWidget->setWindowFlags(0);
+  // if the widget auto hides, it disappear from the workplace and don't allow
+  // children anymore.
+  newWidget->setAutoHide(false);
   return newWidget;
 }
 

+ 7 - 1
Libs/Widgets/ctkPopupWidget.h

@@ -87,7 +87,6 @@ public:
   void setAutoShow(bool);
 
   bool autoHide()const;
-  void setAutoHide(bool);
   
   enum AnimationEffect
   {
@@ -129,6 +128,13 @@ public slots:
   /// Show/hide the popup. It can be conveniently linked to a QPushButton
   /// signal.
   inline void showPopup(bool show);
+  
+  /// Don't automatically close the popup when leaving the widget.
+  /// It's a slot so you can easily connect a checkable PushPin button checked
+  /// signal with it.
+  /// Calling setAutoHide automatically updates the state (open/closed)
+  /// of the popup.
+  void setAutoHide(bool autoHide);
 
 protected slots:
   void updatePopup();