Cant change color of progressBar
-
Simpliest thing, and i was done that(with other widgets, not progBar) many many times.
And now for some reason i cant change styleSheet of my progress bar, and particulary - background color(which is green by default). Here is the code:
ui->progressBarScaned->setStyleSheet("background-color: red");
But i can change just color, which will change text of numbers with % sign in to red.
-
-
-
I find out. It called "chunk".
But here is a problem , if i'll changing it, it will broke whole stylesheet of widget, i mean, margins, no borders now, align of numbers with % changed,and even size.
New question. How can i find out original, default stylesheet of progressBar? In Qt documentation no such info...
-
I find out. It called "chunk".
But here is a problem , if i'll changing it, it will broke whole stylesheet of widget, i mean, margins, no borders now, align of numbers with % changed,and even size.
New question. How can i find out original, default stylesheet of progressBar? In Qt documentation no such info...
-
Here's an example of customizing the progress bar, including the chunk that may help:
http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qprogressbar -
Here's an example of customizing the progress bar, including the chunk that may help:
http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qprogressbar@ambershark yea, i'm already saw that couple hour ago, but i just wanted change green color to red, or some else, i dont want to create whole new SS for my ProgressBar.
There is no hope for that.
-
@ambershark yea, i'm already saw that couple hour ago, but i just wanted change green color to red, or some else, i dont want to create whole new SS for my ProgressBar.
There is no hope for that.
@Engelard Yea like @mrjj said, once you mess with the stylesheet at all, you have to style it completely.
The progressbar color is typically controlled by the window manager. So changing it means Qt no longer uses it's regular drawing routines and instead using the CSS ones. You're pretty much stuck with a custom widget or a full new styling.
Custom progress bar widget would make it pretty easy to change the color and keep a similar look though. You would override it's drawing and just draw the chunks with the QPen/QBrush with the color you wanted. Not too much work, but neither is styling it in CSS.