C++ 使用QML在中继器中获取GlobalText
我在QML中有一个元素,类似这样的东西C++ 使用QML在中继器中获取GlobalText,c++,qt,qml,C++,Qt,Qml,我在QML中有一个元素,类似这样的东西 Repeater { model : 10 Rectangle{ clip: true width: 54 height: 80 color:"transparent" } GlobalText { id: textID
Repeater {
model : 10
Rectangle{
clip: true
width: 54
height: 80
color:"transparent"
}
GlobalText { id: textID
anchors.left: xx.right;
anchors.leftMargin: 8
anchors.verticalCenter: parent.verticalCenter;
text: ""
font.pointSize: 15
}
}
当我尝试使用以下代码更新第一个文本时:
textID.children[1].text = "NewText";
我得到了这个错误:
qrc:qml/test.qml:18:ReferenceError:找不到变量:textID
请帮忙