QML的基础有关问题

QML的基础问题c++中如何获取QML TextInput 的输入数据?[解决办法]TextInput {id: text_input1x: 111y: 80w

QML的基础问题
c++中如何获取QML TextInput 的输入数据?

[解决办法]
TextInput {
id: text_input1
x: 111
y: 80
width: 80
height: 20
text: qsTr("text")
font.pixelSize: 12
}
text_input1.text

[解决办法]
我一般是通过调用一个C++的槽函数来解决,类似以下:

C/C++ code
viewer.rootContext()->setContextProperty("global", CGlobal::instance());