PDA

View Full Version : Problem with widget stylesheets in 4.5.3 on Linux



Lendrick
9th November 2009, 22:04
Greets!

I'm having a bit of issue trying to create a label with a transparent background using a stylesheet. Everything seems to work, except I get a weird radial gradient that I didn't ask for...


testLabel = new QLabel("Hello, world!");
testLabel->setStyleSheet(
"background-color: rgba(255, 255, 255, 0%);"
"font-size: 20px;"
);
addWidget(testLabel);

I've attached an image that shows what I'm talking about.

Any idea where that gradient is coming from and how I can get rid of it? It appears to happen on buttons too.

high_flyer
10th November 2009, 09:57
Actually looks cool! :cool:

But seriously, are you using any other style sheets, on a higher level, that maybe implement this gradient on the label?

bdp32
10th November 2009, 13:00
Does it come from some from using some funky style on your app?

Try starting it in a different style and see if it still happens:

./yourapp -style plastique

Lendrick
10th November 2009, 16:58
Yeah, that was the problem. I'm running KDE 4, and I'm using the Oxygen widget style.

Note below that I'm now setting the widget's style to QWindowsStyle, which is very basic, which seems to work.


QWindowsStyle * WindowsStyle = new QWindowsStyle;
testLabel = new QLabel("Hello, world!");
testLabel->setStyleSheet(
"background-color: rgba(255, 255, 255, 0%);"
"font-size: 20px;"
);
testLabel->setStyle(WindowsStyle);
addWidget(testLabel);

Thanks!

Bart