Context
I'm using a Qt stylesheet to customise a QProgressBar
in my UI. I have a contrasting theme going on, which can be seen below:
I control this via my stylesheet:
QProgressBar {
color: #FFFFFF; /* Text color (not highlighted)
border: 2px solid white; /* Border color */
border-radius: 5px; /* Rounded border edges */
margin-left: 24px;
margin-right: 24px;
text-align: center /* Center the X% indicator */
}
QProgressBar::chunk {
color: #204a87; /* Highlighted text color!? Not working */
background-color: #FFFFFF; /* Color of the 'completed' bar */
}
Problem
Unfortunately, I find myself unable to change the highlighted progress text color once it is eclipsed or covered by the progress bar itself.
This can be seen above.
Solutions
I have attempted to see if I can set a highlight property for the text. I know that from the palette I can set a contrasting highlight color which makes the progress text label switch colors once the progress bar covers it. However, I can't find how to access that property here
QProgressBar::text::highlighted {
color: #204a87; /* Doesn't do anything */
}
I also tried adding a color property to QProgressBar::chunk
as you can see above. This also didn't do anything.
How can I set the contrasting highlight color for the progress bar label in the stylesheet? I've been looking mainly at this Qt resource for guidance but it doesn't cover such a situation.