[PyQt] Style sheets and dynamic properties

Matthew Ovens matt_ovens at hotmail.com
Mon Oct 13 13:47:48 BST 2008


Hi,

I realise there is another thread on this subject, but the
problem there seemed to be different (application of the style sheet on
changing the property rather than setting it initially). I'm trying to
use setProperty() to set a dynamic property on a QTreeWidget which I
can then use as a specifier in a style sheet. On the widget I'm doing:

self.setProperty( "locked", QtCore.QVariant(True) )

and then in the style sheet I do:

QTreeWidget[locked="True"] {...}

But
as far as I can tell the property is never picked up or isn't
evaluating as expected because the style is not applied (other parts of
the style sheet are though, so I know that at least is working). Is
there more to it?

Also, just a little query about styling QTreeWidgetItems - I tried doing:

QTreeWidget::item:!has-children:hover {...}

But
it doesn't seem to take notice of whether the item has children or not.
That's just a minor thing though and I'll have a closer look at it
myself.


Thanks,
Matt
_________________________________________________________________
Make a mini you and download it into Windows Live Messenger
http://clk.atdmt.com/UKM/go/111354029/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081013/29f69483/attachment.html


More information about the PyQt mailing list