PDA

View Full Version : Cannot find the necessary pseudo state



Goodwin
27th May 2015, 12:43
Hello,
I try to style my QTableWidget through StyleSheet
I have already use:
QTableView::item to set padding
QTableView::item:enabled to set background only for enabled cells
QTableView::item:focus to set background if cell is clicked

If I clicked the cell it get background from QTableView::item:focus, and if the cell loses focus it get background from QTableView::item:enabled. Only two states.
But in QTableWidget default style (if not use setStyleSheet) there is 3 states:
1.default background for all cells
2.selected background (when some cell selected)
3. AND if the QTableWidget loses focus, the last selected cell is still highlighted with grey color... -> So if the widget loses focus (or some child widget show on top) you still see in QTableWidget which cell was selected last
The Question is:
Which pseudo state can set Background for the cell that was selected last if QTableWidget loses focus?

jefftee
28th May 2015, 03:32
Have you tried the selection-color and selection-background-color properties?

Edit: Or perhaps the :selected pseudo-state?

Goodwin
28th May 2015, 08:16
Thanks
I use Qt 4.8.1
I don't know what to say...
With QTableView::item -> states :selected, selection-background-color doesn't have any effect at all

Goodwin
4th June 2015, 09:05
any of this lines works with my Project on Windows perfectly:
QTableWidget::item:selected
QTableWidet {selection-background-color... selection-color}
the same lines on linux doesn't works at all... same code... Whyyyyyyyyyyy?
Qt libs identical = 4.8.1
------------------------------
I have no choice but to use QTableWidget::item:focus at least it's works some how