diff options
author | Simone Gaiarin <simgunz@gmail.com> | 2019-03-14 12:41:17 +0100 |
---|---|---|
committer | Simone Gaiarin <simgunz@gmail.com> | 2019-03-19 13:46:43 +0100 |
commit | c826e677658e858eaff309e02571e7876702a4ed (patch) | |
tree | 9f5c7518d782d7ddb53ab4cdcc409303a611c3a6 /src/widgets/kernel/qaction.cpp | |
parent | b17e05729e3404d2fe65f28a903a7a1b9f6cc115 (diff) |
QAction: add exclusionPolicy property
When set to ExclusiveOptional, the new exclusionPolicy property let the
user uncheck the active checkable action in an exclusive group.
[ChangeLog][QtWidgets][QActionGroup] Added new exclusionPolicy
property. Set it to ExclusiveOptional to allow unchecking the active
checkable action in an exclusive group.
Change-Id: I61a9885cfd076d631cddf8c08313e4b488e5dc38
Fixes: QTBUG-71160
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/kernel/qaction.cpp')
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 1ca5514655..f6631199d6 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -1153,8 +1153,9 @@ void QAction::activate(ActionEvent event) if(event == Trigger) { QPointer<QObject> guard = this; if(d->checkable) { - // the checked action of an exclusive group cannot be unchecked - if (d->checked && (d->group && d->group->isExclusive() + // the checked action of an exclusive group may not be unchecked + if (d->checked && (d->group + && d->group->exclusionPolicy() == QActionGroup::ExclusionPolicy::Exclusive && d->group->checkedAction() == this)) { if (!guard.isNull()) emit triggered(true); |