QTabeWidget SelectRows keep background color for some columns on selection?

  • 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!

  • Lifetime Qt Champion


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

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.