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());