[Qt-interest] Stylesheets and widget properties

Andre Somers andre at familiesomers.nl
Thu Oct 21 12:11:55 CEST 2010


Op Do, 21 oktober, 2010 11:58 am, schreef Harry Sfougaris:
> Thanks Andre, that did the trick.
>
> Harry
>
> On 21/10/2010 12:52 ¦Ì.¦Ì., "Andre Somers" <andre at familiesomers.nl> wrote:
>
>>Op Do, 21 oktober, 2010 10:07 am, schreef Harry Sfougaris:
>>> I am using a combination of setProperty("required", true) on my Widgets
>>> and an appropriate stylesheet
>>> eg. *[required="true"] { font: bold; }, to indicate required fields,
>>>which
>>> works fine.
>>> In some cases, I need to change the "required" property on some of the
>>> widgets, based on user input (eg. they select something from a combo,
>>> which determines which fields on the form are required).
>>> The change I make with setProperty is of course is not picked up by the
>>> stylesheet automatically, but I can't seem to find any function to
>>> force
>>> something like a re-evaluation/re-drawing. I tried using
>>> (myWidget)->style()->polish(this) but it doesn't seem to do anything.
>>>
>>> Can anyone please help?
>>
>>http://developer.qt.nokia.com/forums/viewthread/1333 discusses this
>> issue.
>

Don't forget to vote for the bug linked in that thread if you think that
Qt should handle the effects of property changes on the style
automatically. :-)
http://bugreports.qt.nokia.com/browse/QTBUG-14601

André





More information about the Qt-interest-old mailing list