简体   繁体   中英

qml how to keep focus on TextField

I want to keep focus on TextField. For example i am typing something then tap to button. The focus on TextField is moving to button, that's why keyboard is automatically hiding on Android. I am using Qt 5.9.2. Thanks in advance!

在此处输入图片说明

In Qt Quick Controls 2, each control has a focusPolicy property which determines how the control gets focus. The default for controls like Button is Qt.StrongFocus , which means that buttons get focus after being clicked or tabbed into. If you're seeing that a control has focus and you don't want it to, just set its focusPolicy to Qt.NoFocus :

focusPolicy: Qt.NoFocus

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM