の内部コンポーネントのオブジェクトを作成します(外部オブジェクトが作成された後)であるこのような何かすることが可能です外成分の物体
import QtQuick 2.7
import QtQuick.Window 2.2
Window{
id: root_
visible: true
width: 300
height: 300
Component {
id:compouter
Column{
anchors.fill: parent
Component {
id: compinner
Rectangle {
width:parent.width
height:parent.height/2
}
}
}
}
Component.onCompleted: {
var c = compouter.createObject(this)
//var d = c.compinner.createObject(c, {"color": "green"})
//var e = c.compinner.createObject(c, {"color": "red"})
}
}
を、私は外側のオブジェクト内の複数のオブジェクトを作成したいです。しかし、私はエラーが発生するので、これは可能ではありません: TypeError: Cannot call method 'createObject' of undefined
この問題を回避する方法はありますか?外側のオブジェクトのインスタンス化中にすべての内側のオブジェクトをインスタンス化することは、おそらく可能でしょうか?
はい、内部コンポーネントのエイリアスプロパティを作成するというアイディアは、 – FloriHe