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. QTabeWidget SelectRows keep background color for some columns on selection?
Qt 6.11 is out! See what's new in the release blog

QTabeWidget SelectRows keep background color for some columns on selection?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtablewidgetselectrowsbackground colo
2 Posts 2 Posters 1.3k 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.
  • Q Offline
    Q Offline
    qDebug
    wrote on last edited by
    #1

    Hello!

    I try to figure out how to keep the background color in some cells in a QTableWidget if selected. I've got a QTableWidget, 8 columns and depending on the data multiple rows. selectionBehavior is set to SelectRows and if a "line" is selected the background of the selected columns are overwritten by the selection color.

    Is there a way to overwrite this behavior for some cells? For example i want to keep the background for column 3 and 8?

    Thank you!

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

      Hi,

      You'll likely have to implement a custom QStyledItemDelegate and do the painting yourself to match what you want.

      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