Salome HOME
[bos #35160][EDF](2023-T1) Keyboard shortcuts.
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI_NestedButton.cpp
index 83462245853d99c6f6a5e6240184f4bba4a438bc..63c896400ea4eeb6aa4ed698d44cb3e9350251cc 100644 (file)
 #include <QToolBar>
 #include <QEvent>
 
-SHAPERGUI_NestedButton::SHAPERGUI_NestedButton(QObject* theParent,
-                                           const QList<QAction*>& theNestedActions)
-: QWidgetAction(theParent),
+SHAPERGUI_NestedButton::SHAPERGUI_NestedButton(
+  QObject* theParent,
+  const QString& theID,
+  const QList<QAction*>& theNestedActions
+)
+: QtxAction(theParent, false /*isCheckable*/, theID),
   myNestedActions(theNestedActions),
   myAdditionalButtonsWidget(0),
   myButtonFrame(0),
   myThisButton(0)
-{
-}
+{ }
 
-SHAPERGUI_NestedButton::~SHAPERGUI_NestedButton()
+void SHAPERGUI_NestedButton::setEnabled(bool theOn)
 {
+  QtxAction::setEnabled(theOn);
+  if (myThisButton)
+    myThisButton->setEnabled(theOn);
 }
 
 void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow)
@@ -99,28 +104,5 @@ QWidget * SHAPERGUI_NestedButton::createWidget(QWidget * theParent)
 
   showAdditionalButtons(false);
   connect(this, SIGNAL(toggled(bool)), this, SLOT(showAdditionalButtons(bool)));
-  connect(this, SIGNAL(changed()), this, SLOT(actionStateChanged()));
   return myButtonFrame;
 }
-
-bool SHAPERGUI_NestedButton::event(QEvent* theEvent)
-{
-  if (theEvent->type() == QEvent::ActionChanged) {
-    if (myThisButton) {
-      myThisButton->setEnabled(isEnabled());
-      return true;
-    }
-  }
-  return QWidgetAction::event(theEvent);
-}
-
-
-void SHAPERGUI_NestedButton::actionStateChanged()
-{
-  if (isEnabled()) {
-    QString s = "true";
-  } else {
-    QString s = "false";
-  }
-
-}