1

I am using Qt 5.5.1 Opensource on Ubuntu 14.40 LTS 64bit and working on app for Samsung Galaxy Tab 3 10.1 running Android 4.2.2. and I have following testing TextField:

TextField
{
    width: 384
    height: 128

    placeholderText: qsTr("Android Virtual Keyboard does not pop up")

    focus: true

    onTextChanged:
    {
        print("Text changed");
    }   // onTextChanged

    MouseArea
    {
        anchors.fill: parent

        onClicked:
        {
            print("clicked");
            forceActiveFocus(Qt.MouseFocusReason);
            Qt.inputMethod.show();
        }   // onClicked
    }   // MouseArea
}   // TextField

Now, once the focus is of this component is gained - the user selects it on touch screen, message "clicked" is printed on debug console, which is ok, but Android keyboard is not showed so the user cannot enter anytext into it.

Why?

and

Does someone has better experience using TextEdit or even TextArea, I have personally preferred TextField so far because of TextField's placeholderText property? I use several TextField components for entering database connection setup.

Tarod
  • 6,732
  • 5
  • 44
  • 50
KernelPanic
  • 2,328
  • 7
  • 47
  • 90
  • 1
    You should force active focus on textfield, i.e. `.forceActiveFocus()`, here you are forcing the focus on the `MouseArea` itself. But really, why using a `MouseArea` here? It's totally useless since `TextField` already triggers the keyboard. – BaCaRoZzo Jan 20 '16 at 08:30
  • @BaCaRoZzo ok, good guideline, but, where then I should put `forceActiveFocus()` after I omit `MouseArea`? – KernelPanic Jan 20 '16 at 08:32
  • Why would you use `forceActiveFocus`? That's the question. :) Do you have a layered set of `MouseArea`s? Just put them z-*under* the `TextField`s so that active focus is gained by the latter ones. – BaCaRoZzo Jan 20 '16 at 08:34
  • 1
    See [https://stackoverflow.com/questions/37078973/qt-textfield-is-not-invoking-the-keyboard-when-launched-on-android-device/45755411#45755411](https://stackoverflow.com/questions/37078973/qt-textfield-is-not-invoking-the-keyboard-when-launched-on-android-device/45755411#45755411) – Aleksei Kudrin Aug 18 '17 at 11:26

0 Answers0