Hi,
in Qt3's QPopupMenu one could insert a QLabel to get an Caption in a Menu. Qt4's QMenu is only providing a addAction(), which expects a QAction.
Is there any possibility to get an Caption in QMenu?
Thanks
Lykurg
Hi,
in Qt3's QPopupMenu one could insert a QLabel to get an Caption in a Menu. Qt4's QMenu is only providing a addAction(), which expects a QAction.
Is there any possibility to get an Caption in QMenu?
Thanks
Lykurg
Did you try the version of QMenu::addAction which takes a QString argument?
And you can always use QMenu::setTitle() to make a menu with a title.
Hi,
as result I get an QAction:Originally Posted by wysota
Qt Code:
myQMenu->addAction("some_text"); // is the same as: act->setText("some_text"); myQMenu->addAction(act);To copy to clipboard, switch view to plain text mode
What I want is an "item", which is not clickable, checkable etc. and is not highlighted, when the cursor is above like the QActions. The "item" should be insert like an QAction, but behave like an QLabel. (It would be also nice when I could cusomize the frame...)
QMenu::setTitle() is only internal, right? The title isn't displayed in the GUI.Originally Posted by wysota
Lykurg
The only thing you could do is to disable the action.Originally Posted by Lykurg
It isn't marked as internal in the docs. I think it should behave exactly like the previous snippet.QMenu::setTitle() is only internal, right? The title isn't displayed in the GUI.
This is an old thread, but I came across it while searching so I thought I would update it with a solution.
You can use a QWidgetAction and then create a QLabel and set it with setDefaultWidget(). Then just add the QWidgetAction to the menu and you can style the QLabel freely.
Bookmarks