Requesting QML anchors

Stefan de Konink stefan at konink.de
Sat Apr 10 17:47:27 BST 2021


Hello,

I am using PyQT5 at this moment. I would like to set the anchors property 
dynamically from Python on a QMLComponent. I am creating Dynamic QML 
objects.


Requesting via itm.property("anchors.right") gives None.
Requesting via itm.property("anchors") gives <sip.voidptr object at 
0x7f8a4c17c150>


On StackOverflow it suggested if this Pointer would be casted to a QObject 
it is possible to retrieve and set it.

qvariant_cast<QObject*>(
    item->property("anchors")
)->setProperty("top", otherItem->property("bottom"));


I have a workaround to achieve what I want, but I would prefer to resolve 
it cleanly in Python. Any suggestions?

-- 
Stefan


More information about the PyQt mailing list