diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 371c89fe1d..c71d186304 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -266,6 +266,11 @@ void ActionGroup::setExclusive (bool b) _group->setExclusive(b); } +bool ActionGroup::isExclusive() const +{ + return _group->isExclusive(); +} + void ActionGroup::setVisible( bool b ) { Action::setVisible(b); diff --git a/src/Gui/Action.h b/src/Gui/Action.h index 87ee898f5b..c323dac35c 100644 --- a/src/Gui/Action.h +++ b/src/Gui/Action.h @@ -100,6 +100,7 @@ public: void setEnabled (bool); void setDisabled (bool); void setExclusive (bool); + bool isExclusive() const; void setVisible (bool); void setDropDownMenu(bool b) { _dropDown = b; } diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 2cd85c39af..b79ce16cb3 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -1151,6 +1151,19 @@ Action * PythonGroupCommand::createAction(void) Py::Int def(call2.apply(args)); defaultId = static_cast(def); } + + // if the command is 'exclusive' then activate the default action + if (pcAction->isExclusive()) { + QList a = pcAction->actions(); + if (defaultId >= 0 && defaultId < a.size()) { + QAction* qtAction = a[defaultId]; + if (qtAction->isCheckable()) { + qtAction->blockSignals(true); + qtAction->setChecked(true); + qtAction->blockSignals(false); + } + } + } } catch(Py::Exception&) { Base::PyGILStateLocker lock;