View Full Version : Need to show a menu item with disabled look but functional
lalesculiviu
21st October 2009, 07:35
Hello!
I would like to present to the user of my software a menu, with a few actions disabled. But I want that if the user presses these disabled actions, he gets a message box to say that they must be enabled from the settings.
So, I want an enabled action, but with disabled look. Is that possible?
spirit
21st October 2009, 07:39
try to use Style Sheets, take a look at here (http://doc.trolltech.com/4.5/stylesheet-examples.html#customizing-qmenu).
lalesculiviu
21st October 2009, 08:30
try to use Style Sheets, take a look at here (http://doc.trolltech.com/4.5/stylesheet-examples.html#customizing-qmenu).
Thank you, I looked there, but it seems that I can only style the whole menu. But I want to style only a few actions from the whole menu which has more actions.
I tried another approach, to use menu->palette and setPalette, but again the QAction has no palette.
spirit
21st October 2009, 12:09
then disable all necessary actions, install event filter (QObject::installEventFilter) for QMenu and then catch QMouseEvent. an action by mouse click point you can get using QMenu::actionAt
lalesculiviu
21st October 2009, 15:16
OK, thank you! I'll think of your solution.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.