Android 文本字段文本字段不';t QML | QT 5.12上的返回值
我需要帮助。 这是我的代码:Android 文本字段文本字段不';t QML | QT 5.12上的返回值,android,qt,android-ndk,qml,textfield,Android,Qt,Android Ndk,Qml,Textfield,我需要帮助。 这是我的代码: TextField { id: passwordIDText placeholderText: "Insert text..." color: "Black" font.bold: true font.pixelSize: 21 anchors.top: parent.top anchors.topMargin: parent.height / 10 anchors.horizontalCenter:
TextField {
id: passwordIDText
placeholderText: "Insert text..."
color: "Black"
font.bold: true
font.pixelSize: 21
anchors.top: parent.top
anchors.topMargin: parent.height / 10
anchors.horizontalCenter: parent.horizontalCenter
text: "aaa"
}
我使用安卓8(P20)、Qt12.4、安卓NDK20和安卓SDK 28。
所以,当我在android屏幕上单击按钮(我使用20来测试)时,在调试中,为了获取passwordIDText.text,字段是空的,为什么??但如果我将文本设置为“aaa”硬编码,则会得到passwordIDText.text=“aaa”
问题外观文本字段未获取用户插入的值。我在屏幕上的文本字段中插入了123456,然后单击按钮:
MouseArea {
anchors.fill: parent
onClicked: {
var test = passwordIDText.text;
//passwordIDText.text is empty wtf !??
}
}
有人也有同样的问题吗?在旧版本的Android上,TextField工作正常
我的配置:
我认为这可能是一个类似的问题,与您需要访问预测文本时未提交预测文本有关 尝试使用
passwordIDText.displayText
而不是passwordIDText.text
或者,您可以关闭预测性文本输入:
inputMethodHights:Qt.ImhNoPredictiveText
'ImhNoPredictiveText'不能解决我在Qt5.14中遇到的问题。所以我用
inputMethodHints: Qt.ImhSensitiveData
而且效果很好