Qt Textfield Is Not Invoking The Keyboard When Launched On Android Device
Solution 1:
I`ve had similar problem, and it was in the
flags: Qt.FramelessWindowHint
in ApplicationWindow. Remove it for Android. It affects all text inputs in QML.
After removing you will get back proper android system event notifications (the Back key press for example) as a bonus.
Solution 2:
There is nothing wrong with your code. TextFiled {}
item should launch the keyboard automatically when operated on android device. I created a simple "Qt Quick Controls Application" and added your code and it worked for me, but there are couple of points lacking, if you have not done it already:
1. You have not set the Width/Height properties of the item properly.
2. Set anchors to your Rectangle item.
I made slight modifications to your code as below:
Rectangle {
color: "#00000000"
anchors.fill: parent
Row {
anchors.centerIn: parent
spacing: 10
Text {
id: textTitle
text: "Text Field: "width: 100height: 100color: "black"
font.pixelSize: 40horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
TextField {
id: textField
width: 300height: 100text: ""
font.pixelSize: 40placeholderText: qsTr("Enter Your Text")
onEditingFinished: {
console.log("Text entered: ", textField.text)
}
}
}
}
I built the windows desktop version of this appliaction and verified that it works. Also, I have loaded this application on Nexus 6 Android emulator.
Very important point to note is the DPI (Physical Dots Per Inch) value of the android device on which you are going to load your application. Your Item's Width/Height
and Text: Font Point size
values should be set considering the DPI of the android device on which your application is going to get deployed. If not you may see your text appear very small on the real android device, and sometimes if not anchored properly it will hard to notice your text field on the application since you have just one textField item on the screen.
If not directly resolve your problem. Hope this helps you to debug and arrive at the solution.
Post a Comment for "Qt Textfield Is Not Invoking The Keyboard When Launched On Android Device"