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. QProxyStyle control for QTableWidget grid color?
QtWS25 Last Chance

QProxyStyle control for QTableWidget grid color?

Scheduled Pinned Locked Moved Solved General and Desktop
qproxystyleqtablewidget
2 Posts 2 Posters 509 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 30 Mar 2023, 08:52 last edited by
    #1

    Hi, I am using Qt 6.4.2 and my application style is based on Fusion style. I am subclassing QProxyStyle to implement the required changes when having dark and light palettes as my main application palette. I have implemented changes in my QProxyStyle subclass to deal with border colors using drawPrimitive() function and changing the color of QPalette::Window to my desired border color when the primitive element is either PE_IndicatorCheckBox, PE_IndicatorRadioButton, PE_Frame, etc. This produces the desired result of changing the border color and hence a separation between the widget area and background when the background color is very dark (close to QColor{0, 0, 0}).

    However, when my background is very dark my table widget looks like this (the border around the Enabled checkbox is there because I have reassigned the color for QPalette::Window in my drawPrimitive() function when the primitive element is PE_IndicatorCheckBox):

    8f2989b5-613c-4a11-8f5e-cf40a2876b4a-image.png

    Is there any way I could control the grid color of QTableWidget from my QProxyStyle subclass?

    C 1 Reply Last reply 30 Mar 2023, 16:46
    0
    • C CJha
      30 Mar 2023, 08:52

      Hi, I am using Qt 6.4.2 and my application style is based on Fusion style. I am subclassing QProxyStyle to implement the required changes when having dark and light palettes as my main application palette. I have implemented changes in my QProxyStyle subclass to deal with border colors using drawPrimitive() function and changing the color of QPalette::Window to my desired border color when the primitive element is either PE_IndicatorCheckBox, PE_IndicatorRadioButton, PE_Frame, etc. This produces the desired result of changing the border color and hence a separation between the widget area and background when the background color is very dark (close to QColor{0, 0, 0}).

      However, when my background is very dark my table widget looks like this (the border around the Enabled checkbox is there because I have reassigned the color for QPalette::Window in my drawPrimitive() function when the primitive element is PE_IndicatorCheckBox):

      8f2989b5-613c-4a11-8f5e-cf40a2876b4a-image.png

      Is there any way I could control the grid color of QTableWidget from my QProxyStyle subclass?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 30 Mar 2023, 16:46 last edited by
      #2

      @CJha The grid color of a QTableView is determined by QStyle::SH_Table_GridLineColor

      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
      2
      • C CJha has marked this topic as solved on 30 Mar 2023, 18:48

      1/2

      30 Mar 2023, 08:52

      • Login

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