Results 1 to 5 of 5

Thread: Need to show a menu item with disabled look but functional

  1. #1
    Join Date
    Oct 2009
    Location
    Craiova, Romania
    Posts
    46
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Need to show a menu item with disabled look but functional

    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?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Need to show a menu item with disabled look but functional

    try to use Style Sheets, take a look at here.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    lalesculiviu (21st October 2009)

  4. #3
    Join Date
    Oct 2009
    Location
    Craiova, Romania
    Posts
    46
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Need to show a menu item with disabled look but functional

    Quote Originally Posted by spirit View Post
    try to use Style Sheets, take a look at here.
    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.

  5. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Need to show a menu item with disabled look but functional

    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
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #5
    Join Date
    Oct 2009
    Location
    Craiova, Romania
    Posts
    46
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Need to show a menu item with disabled look but functional

    OK, thank you! I'll think of your solution.

Similar Threads

  1. Removing the selection of a menu item from QMenuBar
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 18th March 2009, 10:31
  2. Replies: 1
    Last Post: 18th March 2009, 05:56
  3. creating a "path" for the menu item
    By roxton in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2009, 17:32
  4. Menu Item has no highlight
    By blackfox in forum Qt Programming
    Replies: 6
    Last Post: 24th September 2008, 13:17
  5. Qt/MacOSX preferences menu item
    By mcenatie in forum Qt Programming
    Replies: 4
    Last Post: 14th March 2006, 05:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.