summaryrefslogtreecommitdiff
path: root/src/controls/qquickaction.cpp
diff options
context:
space:
mode:
authorDaiwei Li <daiweili@suitabletech.com>2013-09-18 16:20:18 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 15:17:29 +0200
commit7adeff65148a3967af7b2ec44764a2c275dcd3fe (patch)
tree0345cc58792ec7cd1247696cb6c9b82afba25e7a /src/controls/qquickaction.cpp
parent2aa8ea6850087680af18e14d93bfe40a894607a5 (diff)
downloadqtquickcontrols-7adeff65148a3967af7b2ec44764a2c275dcd3fe.tar.gz
Add source QObject to QQuickAction's triggered signal
Based on a suggestion from Gabriel de Dietrich. Knowing the source object that triggered an action is useful for analytics purposes. Change-Id: I11f62214fa669a91769a0ce25b0c11c0fc0635d0 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/controls/qquickaction.cpp')
-rw-r--r--src/controls/qquickaction.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/controls/qquickaction.cpp b/src/controls/qquickaction.cpp
index 0d77eb32..80f4a47e 100644
--- a/src/controls/qquickaction.cpp
+++ b/src/controls/qquickaction.cpp
@@ -173,16 +173,18 @@ QT_BEGIN_NAMESPACE
\endqml
*/
-/*! \qmlsignal Action::triggered()
+/*! \qmlsignal Action::triggered(QObject *source)
- Emitted when either the menu item or its bound action have been activated.
+ Emitted when either the menu item or its bound action have been activated. Includes
+ the object that triggered the event if relevant (e.g. a Button or MenuItem).
You shouldn't need to emit this signal, use \l trigger() instead.
*/
-/*! \qmlmethod Action::trigger()
+/*! \qmlmethod Action::trigger(QObject *source)
- Will emit the \l triggered signal if the action is enabled. Will also emit the
- \l toggled signal if it is checkable.
+ Will emit the \l triggered signal if the action is enabled. You may provide a source
+ object if the Action would benefit from knowing the origin of the triggering (e.g.
+ for analytics). Will also emit the \l toggled signal if it is checkable.
*/
/*! \qmlsignal Action::toggled(checked)
@@ -430,7 +432,7 @@ bool QQuickAction::event(QEvent *e)
return true;
}
-void QQuickAction::trigger()
+void QQuickAction::trigger(QObject *source)
{
if (!m_enabled)
return;
@@ -438,7 +440,7 @@ void QQuickAction::trigger()
if (m_checkable && !(m_checked && m_exclusiveGroup))
setChecked(!m_checked);
- emit triggered();
+ emit triggered(source);
}
QT_END_NAMESPACE