From ba237e77a1652497be26ec21b507b10ccd0cc762 Mon Sep 17 00:00:00 2001 From: mbs Date: Thu, 4 Jul 2024 09:22:45 +0100 Subject: [PATCH] [bos #42437] fixed problem where sketch validation icons in toolbar were not activated --- src/SHAPERGUI/SHAPERGUI_NestedButton.cpp | 11 +++++++++++ src/SHAPERGUI/SHAPERGUI_NestedButton.h | 10 +++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp index 63c896400..59fde5020 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp @@ -106,3 +106,14 @@ QWidget * SHAPERGUI_NestedButton::createWidget(QWidget * theParent) connect(this, SIGNAL(toggled(bool)), this, SLOT(showAdditionalButtons(bool))); return myButtonFrame; } + +bool SHAPERGUI_NestedButton::event(QEvent* theEvent) +{ + if (theEvent->type() == QEvent::ActionChanged) { + if (myThisButton) { + myThisButton->setEnabled(isEnabled()); + return true; + } + } + return QtxAction::event(theEvent); +} diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.h b/src/SHAPERGUI/SHAPERGUI_NestedButton.h index d3c1a1842..9940b5062 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.h +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.h @@ -28,6 +28,9 @@ #define SRC_SHAPERGUI_NESTEDBUTTON_H_ #include +#include +#include + class QFrame; class QAction; @@ -60,12 +63,13 @@ protected: /// 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 - QWidget* myAdditionalButtonsWidget; ///< widget to precess additional buttons visibility - QFrame* myButtonFrame; ///< frame arround button representation - QToolButton* myThisButton; ///< main button + QPointer myAdditionalButtonsWidget; ///< widget to process additional buttons visibility + QPointer myButtonFrame; ///< frame around button representation + QPointer myThisButton; ///< main button }; #endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */ -- 2.39.2