[Qt-interest] Removing Qt Stylesheet from child dialog

NoRulez norulez at me.com
Thu Jan 27 12:12:34 CET 2011


But I think I must reload the stylesheet after I set the property, because without reloading nothing happens

Am 27.01.2011 um 09:47 schrieb Andre Somers <andre at familiesomers.nl>:

> Op 26-1-2011 22:51, NoRulez schreef:
>>> If you don't want something styled, make sure the styles selectors do not match. One way to do this is to use a property selector and set a corresponding, custom property on the dialogs that you want you style to apply to.
>> Could you please give me a small example on how to do this?
> Something along these lines should work:
> 
> On the dialogs that need to adhere to styling, do something like this:
> myDialog->setProperty("cssStyling", true); //set a property to use as a 
> selector
> 
> Then, formulate your CSS rules to match:
> 
> QDialog[cssStyling="true"] QPushButton { ... // the actual style }
> 
> This will make sure that only pushbuttons that decent somehow from a 
> QDialog that has the cssStyling property set to true will be styled 
> according to that rule. If you don't set the property for the dialogs 
> you don't want the style to apply to, you have achieved your goal.
> 
> Note that Qt unfortunately does NOT update styling if you update such a 
> property used as a CSS selector. So, set the property first, and the 
> style later. Otherwise, you need to force a style recalculation.
> 
> André
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list