Nominate our 2022 Qt Champions!

How do I: Track User Actions (determine how an action is triggered)?

  • I am using a 3-rd party tool to track user interaction with my Qt 5.5 Widget application. I need to keep track of how effective my UI design is by tracking how my users access the actions available to them: by menu, by toolbar, or by shortcut.

    I have a number of QActions defined which are added to the menuBar and a toolbar and they also have a shortcut assigned to them. Is there some direct way to tell how the user selects the action? I've tried overriding the event() method on the MainWindow and also tried using event filters on the MainWindow and on the toolbar but these don't seem to detect the QEvent::Shortcut. The only way I was able to detect the QEvent::Shortcut was with an event filter on a QAction itself. However, I can't seem to capture any mouse events in a QAction event filter. Even if I could, I'm not sure how I can take the mouse event and determine if it came from the toolbar or the menu. I also have hundreds of actions to consider and would prefer to not add filters to them all.

    Anyone have any thoughts?

    Thanks for your help.