[Interest] QML Action source
Daiwei Li
daiweili at gmail.com
Sun Sep 15 04:06:59 CEST 2013
Hi Gabriel,
Thanks for the idea, that is indeed much more general than what I proposed.
I'll give it a try and submit a patch if everything goes well.
Daiwei
On Fri, Sep 13, 2013 at 2:38 AM, deDietrich Gabriel <
Gabriel.deDietrich at digia.com> wrote:
> Hi Daiwei,
>
> On Sep 11, 2013, at 1:45 AM, Daiwei Li <daiweili at gmail.com> wrote:
>
> > I'm investigating adding analytics to my QML application and would like
> to differentiate between reasons why an action is triggered, e.g. from a
> MenuItem vs keyboard shortcut vs Button press. Looking at qquickaction.cpp,
> this information does not seem to be made available.
> >
> > What would be the best bet for getting access to this info? I'm thinking
> of adding an eventSource parameter to the triggered signal that would
> contain the objectName of the object or "shortcut+" + shortcut if it was
> triggered by a shortcut, but would be happy to hear other suggestions.
>
> You could have QQuickAction::trigger() and QQuickAction::triggered() pass
> the (QObject) sender as an optional parameter. Then, make sure that
> QQuickMenuItem, BasicButton, etc. use this. (Remember that you should not
> emit triggered() yourself, but call trigger() instead).This is a very
> common pattern in other frameworks (Cocoa comes to mind), and could make
> sense as an API for QQuickAction. Passing some string only solves your
> particular problem, so that would not be acceptable as a general purpose
> API.
>
> Best regards,
>
> Dr. Gabriel de Dietrich
> Senior Software Developer
> qt.digia.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130914/4a1412fe/attachment.html>
More information about the Interest
mailing list