Hide shorcut text of QMenu Action
I ve looking for an answer all over the internet but i dont seem to get one...
i ve tried changing the stylesheet but i think there's no option to do what i want
in the documentation i ve read that the action has: (icon-text-shorcut text), so what i want is to disable/hide the shorcut text
thanks!
Re: Hide shorcut text of QMenu Action
Well, we could could guess what you are trying to achieve, what you are doing, and what the result is... or you could show us with a screen shot or a small, compilable example that displays the problem and what you have tried.
1 Attachment(s)
Re: Hide shorcut text of QMenu Action
lol, ok.. i want Ctrl+F to disappear :/
Attachment 7274
Re: Hide shorcut text of QMenu Action
What is that?
Is it a QPushButton, QToolButton, QMenu or something else?
Some code how you construct that element would be nice.
Getting rid of that text will be different depending on what it is.
General idea would be not to add the action to that item but to something else, ie parent widget.
Action will still be triggered but the text will not be displayed.
Re: Hide shorcut text of QMenu Action
hi, sorry for the delay.
it`s an QAction from the QMenu->QMenuBar->QMainWindow
i just did that with the QDesigner so the mainwindow implements everything
Re: Hide shorcut text of QMenu Action
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:
Code:
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
}
You can't do that from the designer though.