Salome HOME
Issue #1084: parameter cyclic dependence
[modules/shaper.git] / src / NewGeom / NewGeom_NestedButton.cpp
index ff42227ce6a4229c1da45e2c4539287324ae69e0..1440d92e9705c64505f5e19367fbdf45d590bf13 100644 (file)
@@ -11,6 +11,7 @@
 #include <QFrame>
 #include <QHBoxLayout>
 #include <QToolButton>
+#include <QEvent>
 
 NewGeom_NestedButton::NewGeom_NestedButton(QObject* theParent,
                                            const QList<QAction*>& theNestedActions)
@@ -46,6 +47,9 @@ QWidget * NewGeom_NestedButton::createWidget(QWidget * theParent)
   QHBoxLayout* aBoxLay = new QHBoxLayout(myButtonFrame);
   aBoxLay->setContentsMargins(2, 0, 0, 0);
   aBoxLay->setSpacing(1);
+  QSizePolicy aSizePolicy;
+  aSizePolicy.setControlType(QSizePolicy::ToolButton);
+  myButtonFrame->setSizePolicy(aSizePolicy);
 
   myThisButton = new QToolButton(myButtonFrame);
   myThisButton->setDefaultAction(this);
@@ -73,6 +77,18 @@ QWidget * NewGeom_NestedButton::createWidget(QWidget * theParent)
   return myButtonFrame;
 }
 
+bool NewGeom_NestedButton::event(QEvent* theEvent)
+{
+  if (theEvent->type() == QEvent::ActionChanged) {
+    if (myThisButton) {
+      myThisButton->setEnabled(isEnabled());
+      return true;
+    }
+  }
+  return QWidgetAction::event(theEvent);
+}
+
+
 void NewGeom_NestedButton::actionStateChanged()
 {
   if (isEnabled()) {