From: vsv Date: Fri, 13 Nov 2015 16:04:54 +0000 (+0300) Subject: Issue #1079: Make Apply and Cancel buttons independent on enable/disable of complex... X-Git-Tag: V_2.0.0_alfa2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=89d68aa4e8aae3870bcae0e12baa88775a641ff4;p=modules%2Fshaper.git Issue #1079: Make Apply and Cancel buttons independent on enable/disable of complex action --- diff --git a/src/NewGeom/NewGeom_NestedButton.cpp b/src/NewGeom/NewGeom_NestedButton.cpp index 787390bff..1440d92e9 100644 --- a/src/NewGeom/NewGeom_NestedButton.cpp +++ b/src/NewGeom/NewGeom_NestedButton.cpp @@ -11,6 +11,7 @@ #include #include #include +#include NewGeom_NestedButton::NewGeom_NestedButton(QObject* theParent, const QList& theNestedActions) @@ -76,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()) { diff --git a/src/NewGeom/NewGeom_NestedButton.h b/src/NewGeom/NewGeom_NestedButton.h index 69d8bc297..eb4eb2ea1 100644 --- a/src/NewGeom/NewGeom_NestedButton.h +++ b/src/NewGeom/NewGeom_NestedButton.h @@ -40,6 +40,8 @@ class NewGeom_NestedButton : public QWidgetAction /// Creates the button representation /// \param theParent a parent widget virtual QWidget * createWidget(QWidget * theParent); + + virtual bool event(QEvent* theEvent); private: QList myNestedActions; ///< list of nested actions