Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How I can change anhors property from C++?



  • Hi everyone!

    I have a QQuickPainterItem object in C++. This object has a field as a QML component which I need to change anchors property. How I can do this from C++ in documentation and search I can't find any information about this.

    Thanks for the any help!



  • Use QQmlProperty (:-P see the documentation ;-) )

    @
    QQmlProperty anchorTopMargin(qmlObject, "anchors.topMargin");
    anchorsTopMargin.write(45);
    @


Log in to reply