Pass properties to object created by QML Loader
问题 I have a QML Loader which loads another qml Loader { id: gaugeLoader } PieMenu { id: pieMenu MenuItem { text: "Add Bar Gauge" onTriggered: gaugeLoader.source = "qrc:/Gauges/horizontalBarGauge.qml" } MenuItem { text: "Action 2" onTriggered: print("Action 2") } MenuItem { text: "Action 3" onTriggered: print("Action 3") } } How can I pass parameters to set the ID , width , height and so on of the loaded qml? 回答1: Method 1: Loader::setSource You can use the Loader::setSource(url source, object