How to remove blue selection color from qTableWidget?
-
Hi
What platform are you on ?
For me, its light grey when table dont have focus ?
-
@mrjj said in How to remove blue selection color from qTableWidget?:
What platform are you on ?
Windows, the style can not be changed here since it's windows default. He has to use another style or maybe via stylesheets.
-
@Christian-Ehrlicher
Hi
Ok but he sounded like it was blue even when it lost focus which mine is not on windows 10.it can be changed with
QTableWidget::item{ selection-background-color: red}but Im not sure how to style the "not having focus" color.
-
Hi @mrjj
Thanks for your quick reply.
It can be done with stylesheet but the problem with that is it will change the background color as the table has two background colors for filled rows and empty rows. I just want to remove the focus (blue highlight) from the table. And that can be done with setFocusPolicy() but it is not working.
-
@Jash_13
Hi
Ah yes, alternating colors must also be handled.Well setFocusPolicy should work as the normal fix is then not to allow it to get focus but in what way didnt that work for you ?
I think maybe a delegate would work the best here as it could check if parent has focus and if not, simply skip drawing the selection state.