[Qt-interest] How to change QProgressDialog's Color
Stephen Jackson
spjackson42 at gmail.com
Tue Sep 15 08:30:35 CEST 2009
On Tue, Sep 15, 2009 at 4:59 AM, Ta-Cheng Lin wrote:
>
> If i do this
>
> // Create the progressbar
> progress = new QProgressBar( 100, this );
> // progress->setPaletteBackgroundColor("red");
> progress->setPaletteForegroundColor("green");
>
> The color of the progress bar is still black not green, is there anything
> I need to set?
>
Here is an article that describes how to style a QProgressBar.
http://labs.trolltech.com/blogs/2007/06/12/styling-qprogressbar-and-qscrollbar/
To try this out, add the following code to
examples/qtconcurrent/progressdialog/main.cpp
QString style =
"QProgressBar:horizontal {"
"border: 1px solid gray;"
"border-radius: 3px;"
"background: white;"
"padding: 1px;"
"}"
"QProgressBar::chunk:horizontal {"
"background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5,
stop: 0 green, stop: 1 white);"
"}";
dialog.setStyleSheet(style);
--
HTH,
Stephen Jackson
More information about the Qt-interest-old
mailing list