Solved Customization of component loaded with Loader.
-
Hello,
Is there a way to modify property of component loaded by Loader?simple example:
import QtQuick 2.7 import QtQuick.Controls 2.3 Rectangle { color: "#41cd52" anchors.fill: parent Component { id: comp Rectangle { width: 100 height: 100 color: "black" } } Loader { id: load sourceComponent: comp width: 200 //item.color: "red" // non existing property! How to change it? } }
-
-
Thank you!
Works great! :) -
Or declaratively and to have actual bindings:
Binding { target: loader.item property: "color" value: "red" }
-
item.color = Qt.binding(function() { return "red" })
can work also