0

i have a custom keyboard in qml and has a textField for it so i can use that value somewhere else. When qml page is initialized in application, textfield needs to be clicked to type inside. What i want is when qml initialized should be able to push buttons without clicking textfield first. Here is what i am using

    TextField {
        id:inputValueArea
        width:200;height:35
        anchors.fill : parent
        background:
        font.pixelSize: 20
        placeholderText: ""
        color: "#FFFFFF"
        echoMode: TextInput.Normal
        onAccepted: focus = false
        Keys.onEscapePressed: undo()
    }

I tried to use activeFocusOnPress and inputMethodComposing but it did not work. (source: https://doc.qt.io/qt-5/qml-qtquick-controls-textfield.html#activeFocusOnPress-prop)

What can i code for that? Since i have keyboard as a seperated qml, i couldn't use this solution as a solution (Qt QML Focus an Item (TextField) when showing a StackView Page)

utkuyceng
  • 43
  • 6
  • Are you just asking how to give the TextField input focus? There's always the [forceActiveFocus](https://doc.qt.io/qt-6/qml-qtquick-item.html#forceActiveFocus-method) function. – JarMan Jan 10 '23 at 14:05

0 Answers0