I need analog of https://doc.qt.io/qt-5/qml-qtquick-textinput.html#editingFinished-signal . So when user press enter/space, change focus to anther item I need signal. The problem is that editingFinished is useless for me. It works only if there are no mask/validator, in other case if TextInput
is invalid/incomplete state, there are no editingFinished signal. So I want it emulation. I can not inherit QQuickTextInput
in C++ because of it is private class. I can inherit TextInput
in QML, but how can I get focusOutEvent
inside QML class that inherit TextInput
?
You can use on the activeFocus
property to check whether an object has focus or not.
TextInput {
onActiveFocusChanged: {
if (activeFocus) {
// Gained focus
} else {
// Lost focus
}
}
}
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.