[Interest] CSS class only works in designer, not during runtime

Philipp Kursawe phil.kursawe at gmail.com
Thu Oct 31 15:55:37 CET 2013


Well, it seems these 3 lines solve the issue:

widget->style()->unpolish(widget);
widget->style()->polish(widget);
widget->update();

However this should be handled by the QWidget internally, when it knows
that a dynamic property is used in a style.


On Thu, Oct 31, 2013 at 3:18 PM, Philipp Kursawe <phil.kursawe at gmail.com>wrote:

> I want to style my QLineEdit in case of an error like this:
>
> QLineEdit.error { border: 2px solid orange; }
>
> I have set this style on the QLE parent widget. When I add the dynamic
> "class" property in the designer and set it to "error" the QLE gets a nice
> thick orange border.
> However if I do the same in code:
> edit->property("class", "error")
> the QLE does not change its border.
>
> Any ideas? Do I need to force it to refresh?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131031/3ff8f68d/attachment.html>


More information about the Interest mailing list