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

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.1k 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 9 Jun 2016, 09:55 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 9 Jun 2016, 21:58 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

      1/2

      9 Jun 2016, 09:55

      • 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