Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Possible to track all triggered QActions?
Forum Updated to NodeBB v4.3 + New Features

Possible to track all triggered QActions?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 918 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    philk
    wrote on last edited by
    #1

    For usage analytics I would like to track all triggered QActions globally, without resorting to implement the analytics calls in each QAction. I basically just want t track which QActions are most often used by the user.
    I know I can install an evenfilter to catch QShortcut activations (of QAction) but not if the QAction was not triggered by a shortcut.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      short answer: no, there is no such builtin-functionality in Qt

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Actually, I'm working on very much the same thing: trying to instrument our software to track usage.

        What you might try, is to use QApplication::topLevelWidgets to get pointers to your windows. Then, you use QObject::findChildren<QAction*>() on those widget to get the instantiated QActions. That only works if you give your QActions a parent, of course.

        Also, you'll need to watch out for new actions installed. You could do that by installing an eventfilter on QApplication, and looking for QChildEvents being send. If the child is a QAction, you can add it to your actions to monitor.

        You can then connect to each and every action's triggered signal. Note that in order to get useful data, you'll need to make sure you give every QAction a name as well. Otherwise, you'll have no clue which actions got triggered.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved