View Full Version : QProgressBar stylesheet in visal studio

25th August 2011, 00:54

I'm trying to set a custom stylesheet (exactly this (http://labs.qt.nokia.com/2007/06/12/styling-qprogressbar-and-qscrollbar/)) for a QProgressBar via Visual Studio.

I used that piece of CSS Code to set the stylesheet, but QProgressBar doesn't have a "setStyleSheet" method, so I don't know what to do with it. How does configure a style for it "by hand" (not using QDesigner)?

Added after 20 minutes:

Isolved it.

Visual Studio was going crazy and did not recognize setStyleSheet as a valid method. Now it works fine.

25th August 2011, 03:56
Use QApplication::setStyleSheet()

qApp->setStyleSheet("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);"