I have simple QML app, that shows only one TextField
:
Rectangle {
color: "#00000000"
TextField {
anchors.centerIn: parent
}
}
I thought, that Android keyboard will be shown automatically, when I touch on TextField
, but it's not happening.
I tried to use focus
, Qt.inputMethod.show()
, forceActiveFocus()
inside Component.onCompleted
of TextField
and many other methods, but keyboard not shown anyway.
Tried to use app on other devices and Android 4.1-4.4 versions, but result always the same )))):
Is that a bug or incorrect TextField
's setup?
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:I made slight modifications to your code as below:
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
andText: 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.
I`ve had similar problem, and it was in the
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.