+ allow to set a default action for an exclusive group
This commit is contained in:
parent
ec91085765
commit
cda9bf9ed5
|
@ -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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -1151,6 +1151,19 @@ Action * PythonGroupCommand::createAction(void)
|
|||
Py::Int def(call2.apply(args));
|
||||
defaultId = static_cast<int>(def);
|
||||
}
|
||||
|
||||
// if the command is 'exclusive' then activate the default action
|
||||
if (pcAction->isExclusive()) {
|
||||
QList<QAction*> 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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user