Qt TextField 在 Android 设备上启动时不调用键盘 [英] Qt TextField is not invoking the keyboard when launched on Android device

查看:38
本文介绍了Qt TextField 在 Android 设备上启动时不调用键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 QML 应用程序,它只显示一个 TextField:

I have simple QML app, that shows only one TextField:

Rectangle {
    color: "#00000000"

    TextField {
        anchors.centerIn: parent
    }
}

我想,当我触摸 TextField 时,Android 键盘会自动显示,但它没有发生.我尝试在 Component.onCompleted 中使用 focusQt.inputMethod.show()forceActiveFocus()TextField 和许多其他方法,但无论如何都没有显示键盘.尝试在其他设备和 Android 4.1-4.4 版本上使用应用程序,但结果始终相同 )))):

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 )))):

这是错误还是 TextField 的设置不正确?

Is that a bug or incorrect TextField's setup?

推荐答案

我也遇到过类似的问题,在

I`ve had similar problem, and it was in the

flags: Qt.FramelessWindowHint

在应用程序窗口中.为Android删除它.它会影响 QML 中的所有文本输入.

in ApplicationWindow. Remove it for Android. It affects all text inputs in QML.

删除后,您将获得正确的 android 系统事件通知(例如按下后退键)作为奖励.

After removing you will get back proper android system event notifications (the Back key press for example) as a bonus.

这篇关于Qt TextField 在 Android 设备上启动时不调用键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆