PDA

View Full Version : Style Sheet with Gradient Background



waynew
27th July 2010, 01:58
Can someone give me a simple example of using a gradient on a background color with a style sheet? Or what has worked for you. Can't seem to find any good doc and what I tried was not good. It messed everything else up.

norobro
27th July 2010, 05:23
Hi Waynew,
Try this:
QLabel label("Now is the time for all good men to come to the aid of their party");
label.setStyleSheet("* {color: qlineargradient(spread:pad, x1:0 y1:0, x2:1 y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));"
"background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}");
label.show();