Do not trigger actions disabled directly or on group level
Only allow actions disabled due not being visible to trigger, when enabled is not true. This matches QQuickAction behavior, and doesn't apppear to affect QtGui or QtWidgets. Change-Id: I1a00b80213598ef1560be4c9ee9e65cd6fa6d760 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
8ccae33a81
commit
96eea43d3b
@ -1112,9 +1112,12 @@ void QAction::setData(const QVariant &data)
|
||||
void QAction::activate(ActionEvent event)
|
||||
{
|
||||
Q_D(QAction);
|
||||
if(event == Trigger) {
|
||||
if (event == Trigger) {
|
||||
// Ignore even explicit triggers when explicitly disabled
|
||||
if ((d->explicitEnabled && !d->explicitEnabledValue) || (d->group && !d->group->isEnabled()))
|
||||
return;
|
||||
QPointer<QObject> guard = this;
|
||||
if(d->checkable) {
|
||||
if (d->checkable) {
|
||||
// the checked action of an exclusive group may not be unchecked
|
||||
if (d->checked && (d->group
|
||||
&& d->group->exclusionPolicy() == QActionGroup::ExclusionPolicy::Exclusive
|
||||
|
Loading…
Reference in New Issue
Block a user