Enhanced styling of expander icon in tree view

Now it's compatible with the different selection styles
(some include the decoration, some don't)
This commit is contained in:
klayoutmatthias 2017-03-07 21:41:47 +01:00
parent e06224e00d
commit fea965a321
1 changed files with 2 additions and 2 deletions

View File

@ -59,14 +59,14 @@ BackgroundAwareTreeStyle::drawPrimitive (QStyle::PrimitiveElement pe, const QSty
cg = QPalette::Inactive;
}
}
if (opt->state & State_Selected) {
if ((opt->state & State_Selected) && styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, w)) {
c = opt->palette.color (cg, QPalette::HighlightedText);
} else {
c = opt->palette.color (cg, QPalette::Text);
}
if (! (opt->state & State_MouseOver)) {
if (c.green () < 128) {
c = QColor ((c.red () * 3 + 255) / 4, (c.green () * 3 + 255) / 4, (c.blue () * 3 + 255) / 4);
c = QColor ((c.red () * 2 + 255) / 3, (c.green () * 2 + 255) / 3, (c.blue () * 2 + 255) / 3);
} else {
c = QColor ((c.red () * 8) / 9, (c.green () * 8) / 9, (c.blue () * 8) / 9);
}