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. Give background colour to QHeaderView?

Give background colour to QHeaderView?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 703 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    I create a QTreeWidgetItem and add it as the root-level item to TTreeWidget, which is a subclass of QTreeWidget. To give it a background in a way that hinders the users ability to use setStyleSheet() I can just use QTreeWidgetItem->setBackground().

    How can I give the widget a background that still allows the use of setStyleSheet()? I've tried targetting the table header via qss in so many ways and nothing is sticking.

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

      Hi,

      What about clearing the background when the user sets a non empty stylesheet ?

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

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vadi2
        wrote on last edited by
        #3

        How can a stylesheet target the background?

        If the stylesheet doesn't target the headers background, then the colour will simply lost and that's a bug. I need to re-add the colour back in via stylesheet.

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

          See the QHeaderView example in Qt's documentation.

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

          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