PDA

View Full Version : Stop QDialog from inheriting parent's palette.



Avrohom
7th September 2009, 14:09
Hi, I wonder if someone can help me out here. I have got a QDialog with custom stylesheet (basically background color). In that Dialog I show another Dialog. When the other Dialog shows, it does so using the first Dialogs palette i.e. background.

How can I prevent that the Second Dialog should not use the first Dialog's palette, but use it's own?

yogeshgokul
7th September 2009, 14:17
How you are setting the style sheet for first dialog ?

Avrohom
7th September 2009, 17:58
In the designer.

yogeshgokul
8th September 2009, 05:59
Ok this is clear, you are setting some style sheet for QDialog, so every QDialog in the project will have the same style sheet.
If you want to apply the style sheet for one particular dialog, you have to do something like this:

//Lets assume your QDialog instance name is dlg.
QDialog#dlg {
background-color: green;
}This will change the style sheet of only one dialog.

For more selectors here. (http://www.w3.org/TR/CSS2/selector.html#q1)