Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

auto-open keybord for first listview textinput item



  • hi,

    i try to programatically open android‘s keyboard after my dialog opened.
    that dialog contains a list view, that holds a delegate, that contains of rectangles and textinputs.

    what‘s the qml way of auto-showing keyboard and allowing users text input to be put into first textinput in list?

    i already managed opening keyboard by showKeyboard() but it does not put characters into any textviews...

    regards, armin



  • @armin2 hi
    make sure your text input has focus property set to true

    TextInput {
      id: textInput
      focus: true
    }
    


  • focus is set, but doesnt work. keystrokes just get lost.


  • Moderators

    @armin2

    ListView {
        id:myView
        Component.onCompleted: {
             var firstItem = myView.itemAtIndex(0)
             if(firstItem)
                 firstItem.forceActiveFocus()
        }
        ......
        ....
    }
    

Log in to reply