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. Frame color/palette of QGroupBox?
Forum Update on Monday, May 27th 2025

Frame color/palette of QGroupBox?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpaletteqgroupboxqstyleqproxystyle
4 Posts 4 Posters 741 Views
  • 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.
  • C Offline
    C Offline
    CJha
    wrote on 16 Jan 2023, 09:11 last edited by CJha
    #1

    Hi, I am trying to figure out the border color of QGroupBox. I have applied a fusion style and black palette to QApplication and my QGroupBox looks like this:
    a1f42102-ee8c-473a-8ed9-fb408c1330e1-image.png
    As you can see the border color of QGroupBox is neither black nor white but a shade of gray. I am trying to figure out which color is this.

    I have subclassed QProxyStyle and in its drawPrimitive() function when the primitive element is equal to QStyle::PE_FrameGroupBox I am printing all the colors that are available in its current palette in all its states (Active, inactive, and Disabled) but none of the colors seem to be the border color of the QGroupBox.

    I tried to figure out the QGroupBox border color using the color picker from QColorDialog, here are the results for different palettes:

    • qApp->setPalette(QPalette{QColor{0,0,0}}) => QColor(ARGB 1, 0.0901961, 0.0901961, 0.0901961)
    • qApp->setPalette(QPalette{QColor{10,10,10}}) => QColor(ARGB 1, 0.121569, 0.121569, 0.121569)
    • qApp->setPalette(QPalette{QColor{20,20,20}}) => QColor(ARGB 1, 0.152941, 0.152941, 0.152941)

    As you can see the border color does change with the change in the main color of the palette applied, how is this calculated and how can I get this programmatically from Qt?

    1 Reply Last reply
    1
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 16 Jan 2023, 18:16 last edited by
      #2

      Fusion style ignores palette for the groupbox frame and uses a hardcoded semi-transparent pixmap.

      See the source.

      R 1 Reply Last reply 14 days ago
      3
      • C Chris Kawa
        16 Jan 2023, 18:16

        Fusion style ignores palette for the groupbox frame and uses a hardcoded semi-transparent pixmap.

        See the source.

        R Offline
        R Offline
        RokeJulianLockhart
        wrote 14 days ago last edited by
        #3

        @Chris-Kawa, that's horrible. Do you have any idea whether that's deliberate? That seems worth filing a bug about.

        When using a forum, remember to tag the person you are responding to, in case they are not subscribed to the thread.

        C 1 Reply Last reply 14 days ago
        0
        • R RokeJulianLockhart
          14 days ago

          @Chris-Kawa, that's horrible. Do you have any idea whether that's deliberate? That seems worth filing a bug about.

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote 14 days ago last edited by
          #4

          @RokeJulianLockhart said in Frame color/palette of QGroupBox?:

          That seems worth filing a bug about.

          A style can do whatever it likes. Here it was decided to paint them through a semi-transparent png. It's maybe not nice but...
          if you come up with an equivalent solution which does exactly the same with some palette stuff - feel free to post a patch.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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