Table view: custom alternate row colors?
-
wrote on 21 May 2019, 02:03 last edited by
how do i get something like this?
when i try to use a style sheet, like this:tracksList->setStyleSheet("alternate-background-color: #bfffbf; background-color: #deffde;");
it colorizes the ENTIRE background including the header (sort-column) bar, and gives me non-platform scroll bars. this is supposed to be a mac (with mac scroll bars):
I just want the table view background color set, not the sort-column header nor the scroll bars. how?
-
wrote on 22 May 2019, 16:42 last edited by
-
wrote on 21 May 2019, 11:21 last edited by VRonin
try using the item scope
tracksList->setStyleSheet("QTableView::item:alternate { background-color: #bfffbf; } QTableView::item { background-color: #deffde; }");
-
wrote on 21 May 2019, 16:23 last edited by
-
wrote on 22 May 2019, 15:38 last edited by davecotter
okay so the final part is: now that i've got the BG colors lookin sweet, suddenly the SELECTION color is all wiggy. ie: without setting the alt-rows colors, selection looks like this:
but WITH the alt-rows colors set, it looks like this?
ie: no actual selection hilight, but the text does turns white?
I actually need it to have that very dark selection look. I don't see in the doc on style sheets how to accomplish that?
-
okay so the final part is: now that i've got the BG colors lookin sweet, suddenly the SELECTION color is all wiggy. ie: without setting the alt-rows colors, selection looks like this:
but WITH the alt-rows colors set, it looks like this?
ie: no actual selection hilight, but the text does turns white?
I actually need it to have that very dark selection look. I don't see in the doc on style sheets how to accomplish that?
wrote on 22 May 2019, 15:54 last edited by@davecotter Hi,
Use palette instead of stylesheet so you will not have the issue with selection.QPalette p = tracksList.palette(); p.setColor(QPalette::Base, color1); p.setColor(QPalette::AlternateBase, color2); tracksList.setPalette(p);
-
wrote on 22 May 2019, 16:42 last edited by
1/6