From c826e677658e858eaff309e02571e7876702a4ed Mon Sep 17 00:00:00 2001 From: Simone Gaiarin Date: Thu, 14 Mar 2019 12:41:17 +0100 Subject: 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 --- src/widgets/kernel/qaction.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/kernel/qaction.cpp') 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 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); -- cgit v1.2.3