Ok, I have no idea how to hide the shortcut text from action without disabling it (the shortcut).
Other approach could be not to set the shortcut on the action but add it (the shortcut) to the main window, something like this:
MainWindow
::MainWindow( QWidget* parent
){
QMenu* m
= this
->menuBar
()->addMenu
( "test" );
m->addAction( "close", this, SLOT( close() ) ); // action will not have a shortcut but will still do the right thing when clicked
connect( s, SIGNAL( activated()), a, SLOT( trigger() ) ); // shortcut is not visible but will trigger the action which in trun will do the right thing
}
MainWindow::MainWindow( QWidget* parent )
: QMainWindow( parent )
{
QMenu* m = this->menuBar()->addMenu( "test" );
m->addAction( "close", this, SLOT( close() ) ); // action will not have a shortcut but will still do the right thing when clicked
QShortcut* s = new QShortcut( Qt::CTRL + Qt::Key_Q, this );
connect( s, SIGNAL( activated()), a, SLOT( trigger() ) ); // shortcut is not visible but will trigger the action which in trun will do the right thing
}
To copy to clipboard, switch view to plain text mode
You can't do that from the designer though.
Bookmarks