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. QtWidgets ColorRole
Forum Updated to NodeBB v4.3 + New Features

QtWidgets ColorRole

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 562 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.
  • J Offline
    J Offline
    James Brock
    wrote on last edited by James Brock
    #1

    What do these five ColorRoles do?

    https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPalette.html#PySide6.QtGui.QPalette.ColorRole

    There are some color roles used mostly for 3D bevel and shadow effects.

    QPalette.Light
    QPalette.Midlight
    QPalette.Dark
    QPalette.Mid
    QPalette.Shadow

    Do these five ColorRoles effect the color of anything in QtWidgets?

    Motif scroll bars depend on Mid to be slightly different from Window.

    What are “Motif scroll bars”?

    Pl45m4P 1 Reply Last reply
    0
    • J James Brock

      What do these five ColorRoles do?

      https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPalette.html#PySide6.QtGui.QPalette.ColorRole

      There are some color roles used mostly for 3D bevel and shadow effects.

      QPalette.Light
      QPalette.Midlight
      QPalette.Dark
      QPalette.Mid
      QPalette.Shadow

      Do these five ColorRoles effect the color of anything in QtWidgets?

      Motif scroll bars depend on Mid to be slightly different from Window.

      What are “Motif scroll bars”?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @James-Brock said in QtWidgets ColorRole:

      What do these five ColorRoles do?

      I can't hold back from quoting Rambo here:

      Rambo said in Rambo III:

      - "It's a blue light.”
      - „What does it do?”
      - „It turns blue."

      :D

      @James-Brock said in QtWidgets ColorRole:

      Do these five ColorRoles effect the color of anything in QtWidgets?

      These are just the roles. The actual color may differ from palette setting to palette setting :)

      @James-Brock said in QtWidgets ColorRole:

      What are “Motif scroll bars”?

      • https://en.wikipedia.org/wiki/Motif_(software)

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      J 1 Reply Last reply
      3
      • Pl45m4P Pl45m4

        @James-Brock said in QtWidgets ColorRole:

        What do these five ColorRoles do?

        I can't hold back from quoting Rambo here:

        Rambo said in Rambo III:

        - "It's a blue light.”
        - „What does it do?”
        - „It turns blue."

        :D

        @James-Brock said in QtWidgets ColorRole:

        Do these five ColorRoles effect the color of anything in QtWidgets?

        These are just the roles. The actual color may differ from palette setting to palette setting :)

        @James-Brock said in QtWidgets ColorRole:

        What are “Motif scroll bars”?

        • https://en.wikipedia.org/wiki/Motif_(software)
        J Offline
        J Offline
        James Brock
        wrote on last edited by
        #3

        @Pl45m4 So the answer is no, these five ColorRoles do not effect the color of anything in QtWidgets.

        Pl45m4P 1 Reply Last reply
        0
        • J James Brock

          @Pl45m4 So the answer is no, these five ColorRoles do not effect the color of anything in QtWidgets.

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @James-Brock

          Anything "default" you see is painted according to its role and the palette used, which is part of the application "style".
          If you change the role on some widget element, it probably would receive a different color.
          However the style/palette defines the actual color and what is painted, not the role.

          This is how themes work. Everything has its own role in order to still look good with any style and to avoid black on black or white on white. The roles assigned to native elements ensure that.

          If you switch to a dark theme, like shown here

          • https://doc.qt.io/qtcreator/creator-how-to-switch-ui-themes.html

          the palette changes and it still looks good.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          J 1 Reply Last reply
          1
          • Pl45m4P Pl45m4

            @James-Brock

            Anything "default" you see is painted according to its role and the palette used, which is part of the application "style".
            If you change the role on some widget element, it probably would receive a different color.
            However the style/palette defines the actual color and what is painted, not the role.

            This is how themes work. Everything has its own role in order to still look good with any style and to avoid black on black or white on white. The roles assigned to native elements ensure that.

            If you switch to a dark theme, like shown here

            • https://doc.qt.io/qtcreator/creator-how-to-switch-ui-themes.html

            the palette changes and it still looks good.

            J Offline
            J Offline
            James Brock
            wrote on last edited by
            #5

            @Pl45m4 Specifically are there any examples of Qt widgets which get their color from these five roles? (I'm not asking “how themes work.”)

            Pl45m4P 1 Reply Last reply
            0
            • J James Brock

              @Pl45m4 Specifically are there any examples of Qt widgets which get their color from these five roles? (I'm not asking “how themes work.”)

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #6

              @James-Brock

              Every widget is styled using the app style / palette.
              For specific widgets check the source yourself what elements are used and what roles are assigned to it.


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              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