[Qt-interest] Set inactive color to match active color of a QTableWidget selection
David Doria
daviddoria at gmail.com
Fri Oct 21 04:32:50 CEST 2011
I would like to set the "!active" background-color of QTableWidget to
match the "active" color. I tried to do this in a style sheet:
QTableWidget::item:selected:!active{
background-color:QTableWidget::item:selected:active;
}
but I was told that you cannot access properties like that.
I then tried to do it like this:
QPalette palette = myTableWidget->palette();
palette.setColor( QPalette::Inactive, QPalette::Highlight,
palette.color(QPalette::Active, QPalette::Highlight) );
palette.setColor( QPalette::Inactive, QPalette::HighlightedText,
palette.color(QPalette::Active, QPalette::HighlightedText) );
myTableWidget->setPalette( palette );
but the inactive color seems to remain different from the active
color. Any idea what I'm doing wrong?
David
More information about the Qt-interest-old
mailing list