I want my QTreeWidget to have the same text highlighting when it is inactive as when it is active. So I did:
setPalette(p);
QPalette p = palette();
p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText));
setPalette(p);
To copy to clipboard, switch view to plain text mode
It did nothing. So I tried:
for (int colorRole
=0; colorRole <
QPalette::NColorRoles; colorRole
++) {
QPalette::ColorRole role
= static_cast<QPalette
::ColorRole>
(colorRole
);
}
setPalette(p);
QPalette p = palette();
for (int colorRole=0; colorRole < QPalette::NColorRoles; colorRole++)
{
QPalette::ColorRole role = static_cast<QPalette::ColorRole>(colorRole);
p.setColor(QPalette::Inactive, role, p.color(QPalette::Active, role));
}
setPalette(p);
To copy to clipboard, switch view to plain text mode
It also didn't work. I have also tried setting the palette on the viewport and had a quick look to see whether I'm supposed to set it on the delegate (but the delegate doesn't have a palette). This seemingly 5 minute task is now chewing up hours. Does anybody know what I have to do make it so that my inactive and active highlights on a QTreeWidget are the same?
Bookmarks