[PyQt] Qt Property System

Christopher Probst christop.probst at gmail.com
Thu Jun 15 16:30:55 BST 2017


Hi,

I am starting to feel a lot of love for PyQt. I am inquiring about how the
Qt Property system translates into PyQt

The documentation states:
"PyQt5 does not support the setting and getting of Qt properties as if they
were normal instance attributes. This is because the name of a property
often conflicts with the name of the property’s getter method."

Does this mean I can't write label.setProperty("text" , "HelloWorld")? I am
not exactly sure what this means.

I have tried this for instance and it works great:

for i in range(0, propertyCount):
        metaProperty = metaObject.property(i)
        typeName = metaProperty.typeName()
        propertyName = metaProperty.name()
        value = object.property(metaProperty.name())
        print("propertyName: " + propertyName + ", value: " + str(value) +
", type: " + typeName)

Do we use the Qt Property system in PyQt?

Thanks,
Chris Probst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170615/5d430463/attachment.html>


More information about the PyQt mailing list