How do I end activeFocus?
Unsolved
General and Desktop
-
I have a TextInput and I am looking for a way to end activeFocus s/t once a user presses enter on the Qt virtualKeyboard activeFocus falls off of the TextInput. I am trying to use the selectAll() method and this is working but not the way I need it to work, here is my code:
TextInput{ id:inputItem text: "Enter text here" EnterKeyAction.enabled: inputItem.text.length > 0 || inputItem.inputMethodComposing EnterKeyAction.label: "Next" Keys.onReleased: { if (event.key === Qt.Key_Return) { activeFocus = false } } onActiveFocusChanged: { if(activeFocus) { selectAll() inputPanelContainer.textDisplay = inputItem.text } } onDisplayTextChanged: { inputPanelContainer.textDisplay = text } } }
So, currently, the first time I click in the TextInput box the string is highlighted; however, the cursor just stays in the TextInput box even after I press enter. I want the focus to fall off of the TextInput each time the user enters their string s/t when they click the TextInput box again the string will highlight again, is this possible? Perhaps I am calling selectAll() in the wrong way or perhaps I am setting activeFocus incorrectly?