c++ - Qt qml - how to use component in its definition? -
i have implement treeview
in qml
. because each subtree treeview
itself, want use treeview
component in treeview
definition (this repeater
on end).
this part of code reference component defining.
you can see rootdelegate
id
of component
.
problem qt gives error unable assign qquickrow qqmlcomponent
repeater { model: childrens delegate: rootdelegate }
treeview.qml
import qtquick 2.0 component { id: rootdelegate column { row { id: itemcontrol spacing: 2 rectangle { anchors.verticalcenter: parent.verticalcenter gradient: gradient { gradientstop { position: 0.0; color: "#eeeeee" } gradientstop { position: 1.0; color: "#404040" } } width: openchar.implicitwidth height: openchar.implicitheight - 6 radius: 3 mousearea { anchors.fill: parent cursorshape: qt.pointinghandcursor } text { id: openchar text: "+" color: "black" anchors.centerin: parent } } rectangle { height: 1 color: "#a0a0a0" width: 10 anchors.verticalcenter: parent.verticalcenter } text { text: model.text color: "white" } } repeater { model: childrens delegate: rootdelegate } } }
you trying use Сomponent recursively in itself, not allowed in qml
Comments
Post a Comment