[Interest] Possible to track all executed Actions?

André Somers andre at familiesomers.nl
Tue Oct 29 08:25:51 CET 2013


Op 29-10-2013 7:17, Bo Thorsen schreef:
> Den 28-10-2013 10:19, Philipp Kursawe skrev:
>> I would like to log all executed QActions in a global way without having
>> a QActionManager or the like that every component in the app has to use.
>> Is that possible in Qt?
> No, there is no way to do this if you only use QAction.
>
> There are several things you can do, though. One possible solution is to
> subclass QAction and log all triggered() signals. This works well if you
> have code building your UI, but not with designer.
>
> I guess you could hack moc or uic. This could give you exactly what you
> want. And IMHO this would be the worst possible solution.
>
> Bo.
Well, if you have all your QActions directly or indirectly parented to 
one of your windows, you could find them all and connect to them that 
way. Of course, you'll have to monitor for new actions being added as a 
child to objects, but that too is doable.

André




More information about the Interest mailing list