PDA

View Full Version : ToolBar shortcuts don't work when QToolBar is hidden



davethomaspilot
1st August 2018, 00:14
I've defined shortcuts for the QActions in the Mainwindow toolbar. They work fine when the ToolBar is visible.

But, to maximize screen real estate, I hide the MenuBar and ToolBar except when the mouse pointer is over the top of the MainWindow screen. The user can hover over the menubar or toolbar to unhide it, then click on an icon or menubar item. But normally they will prefer to type a key on a tiny keyboard.

I've tried changing the QAction, shortcut context to to Application, but this has no effect.

I created the shortcuts in QtDesigner. Do I instead need to create the short cuts in code and separately connect them to slots that are now associated with ToolBar QActions?

wysota
20th August 2018, 09:12
Add the actions from the toolbar to your window widget (using QWidget::addAction).