nAkhmedov
nAkhmedov

Reputation: 3592

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!

enter image description here

Upvotes: 0

Views: 2327

Answers (1)

Mitch
Mitch

Reputation: 24386

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

Upvotes: 3

Related Questions