Dynamically anchoring in QML
-
Hi
I am having main.qml and Square.qml. I am using Loader to load Square.qml on mouse click from main.qml. I just want to know if I can anchor Square.qml (just a rectangle) with elements of main.qml as soon as it load it? And what is the way that I can use? -
You can simply anchor the
Loaderto the desired elements onmain.qml. TheLoaderwill set the loaded item's geometry automatically.
See http://doc.qt.io/qt-5/qml-qtquick-loader.html#loader-sizing-behavior