Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ID/name selectors for QMenu item styles?

ID/name selectors for QMenu item styles?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 712 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt_User72653
    wrote on last edited by
    #1

    I'm styling a QMenu with the following stylesheet:

        QMenu {
          ...
        }
        QMenu::item {
          ...
        }
        QMenu::item:selected {
          ...
        }
        #empty {
          ...
        }
    

    But, the #empty selector isn't working at all for a QWidgetAction. I've made sure to call setObjectName on it. I've tried naming the QMenu itself and using #menu in the CSS, which does work.

    What I'm trying to do is style it as if it was disabled, but still have it emit triggered signals.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I dont think you can style a QAction/QWidgetAction as such.
      But the widget underneath surely is.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by
        #3

        Hmm, well, the menu will only have one item in it if the #empty item is in it, so I can probably just change the style for the menu, then set it back when another item is inserted.

        I'm curious, though, how I can set a style for just one item, because I imagine at some point I may have to do that.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved