PDA

View Full Version : Change background color of a QStackWidget



fiodis
11th December 2012, 20:33
In Qt 4.8, how would I change the background color of a QStackWidget? The trouble is that I have one of those over a QGLWidget, and it's showing up as just a black box. Worse, I put some labels in it with text, and that text is black, so they're effectively invisible. Is there a way to set the color of the QStackWidget, possibly with a level transparency? I found some references to something called a style sheet, but I'm not entirely clear how to use it. I've been using Qt Designer to make my UI, so I'm not sure where or how to call the setStyleSheet function.

EDIT - I've found how to change the color in Qt Designer, but for some reason transparency is not working. I would set the backgroud gradient of a QStackWidget, and set an alpha of 100, but it still obscures everything behind it.

myta212
14th December 2012, 08:19
Hi,
You can right click over QStackWidget and choose "Change Stylesheet"
Choose "Add Color" --> Background-Color. You can change R, G, B, or alpha value from your widget with this method.

Thank you,

myta