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. How to set stylesheet for all class except QMenu?
Qt 6.11 is out! See what's new in the release blog

How to set stylesheet for all class except QMenu?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 433 Views 3 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.
  • U Offline
    U Offline
    ungrown
    wrote on last edited by
    #1

    So that all context menu could stay as the OS native style without changed by stylesheet, which is my goal.

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

      Hi and welcome to devnet,

      Write a stylesheet specifier for the widgets you want to style.

      AFAIK, there's no "exclude" for only one class.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      U 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        Write a stylesheet specifier for the widgets you want to style.

        AFAIK, there's no "exclude" for only one class.

        U Offline
        U Offline
        ungrown
        wrote on last edited by
        #3

        @SGaist
        Hi, thanks for help. So you mean that I have to write some "selector" that choose all other classes except the QMenu one, correct?

        mrjjM 1 Reply Last reply
        0
        • U ungrown

          @SGaist
          Hi, thanks for help. So you mean that I have to write some "selector" that choose all other classes except the QMenu one, correct?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ungrown
          Hi
          Yes. using names or class types for the selector.
          Sadly there is no "not" outside of pseudo-states as far as I know.

          Sometimes you can also cheat and apply the stylesheet to MainWindow central as most widgets lives there but
          not the main MenuBar.

          1 Reply Last reply
          1

          • Login

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