aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickaction.cpp')
-rw-r--r--src/quicktemplates2/qquickaction.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp
index 0e51daef..fd899d0b 100644
--- a/src/quicktemplates2/qquickaction.cpp
+++ b/src/quicktemplates2/qquickaction.cpp
@@ -523,16 +523,26 @@ void QQuickAction::toggle(QObject *source)
void QQuickAction::trigger(QObject *source)
{
Q_D(QQuickAction);
- if (!d->enabled)
+ d->trigger(source, true);
+}
+
+void QQuickActionPrivate::trigger(QObject* source, bool doToggle)
+{
+ Q_Q(QQuickAction);
+ if (!enabled)
return;
- QPointer<QObject> guard = this;
+ QPointer<QObject> guard = q;
// the checked action of an exclusive group cannot be unchecked
- if (d->checkable && (!d->checked || !d->group || !d->group->isExclusive() || d->group->checkedAction() != this))
- toggle(source);
+ if (checkable && (!checked || !group || !group->isExclusive() || group->checkedAction() != q)) {
+ if (doToggle)
+ q->toggle(source);
+ else
+ emit q->toggled(source);
+ }
if (!guard.isNull())
- emit triggered(source);
+ emit q->triggered(source);
}
bool QQuickAction::event(QEvent *event)