Is Qt's dynamic properties really so dynamic with stylesheets?
I have the basic example from stylesheets and dynamic properties:
/*stylesheet:*/
*[field_mandatory="true"] { background-color: "yellow";}
And I have this happening at runtime somewhere in the code:
/*code:*/
myWidget->setProperty("field_mandatory", field->isFilled() );
Nothing changes in UI, when this property is changed at runtime.
Does anyone have ideas what must be done to update Qt's stylesheet engine when changing properties, or is it even capable handling these kinds of cases?
Btw. I'm using Qt 4.4
Qt allows you to decorate your Graphical User Interfaces (GUIs) using a style sheet language called Qt Style Sheets, which is very similar to Cascading Style Sheets (CSS) used by web designers to decorate their websites.
Qt has the following recommendation in their FAQ:
style()->unpolish(theWidget);
style()->polish(theWidget);
They also say you can reset the stylesheet by doing the following but it is more expensive:
setStyleSheet(styleSheet());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With