Finally, following http://stackoverflow.com/questions/1894395/in-qt-how-to-show-keyboard-shortcuts-in-menu-but-disable-them
I ended up hiding shortcuts in the menu without disabling them by setting an empty QKeySequence() to the menu actions when the menu is aboutToShow() and then setting them again when the menu is aboutToHide(). 2013/7/4 Vincent <vincentb1...@gmail.com> > Hi J-P, > > The application is always-on-top. So in general, the application is > visible while being not active and hence shortcuts are not working in that > case. Shortcuts would be documented but not shown in the menu in order to > not confuse the user (they would try to hit the shortcut and no action > would be triggered because application is not active; and let shortcuts > available for the users that like them). > > I did replace the action's shortcuts by explicit QShortcut's and then > connect their triggered() signals to QAction trigger() slots. But then when > disabling an action and firing the new related QShorcut, the QAction is > triggered(). > > The application relies on state machine where triggering transition relies > on QAction's. I would like to keep QAction's as a kind of central where I > connect my events. > > Thanks, > > Cosmo > > > 2013/7/3 Nurmi J-P <jpnu...@digia.com> > >> On Jul 3, 2013, at 7:48 PM, Vincent <vincentb1...@gmail.com> wrote: >> >> > Hello, >> > >> > I'm adding a series of QAction's to a menu. Shortcuts are associated to >> each of these QAction's. >> > >> > I would like to hide the shortcuts but at the same time leaving them >> active. >> > >> > Do you know how to that? >> > >> > If it is not possible by default, is there a possibility to override a >> Qt method? >> > >> > Thanks, >> > >> > Cosmo >> >> >> Hi, >> >> Not sure why you want to hide the shortcuts, but you can always create >> plain QShortcuts instead of assigning the shortcuts to QActions. >> >> -- >> J-P Nurmi >> >> >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest