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

ListView model navigation with keyboard problem



  • Hi,

    Regarding this listview of texfields
    Capture1604.JPG
    I am using ListModel index delegate to scroll down between Textfields in my listview , forcing listView.currentIndex = indexOfDelegate

    This is done using this func in the TextField :

    Keys.onDownPressed:
    {
    if (indexOfThisDelegate < listView.count -1)
    {
    listView.currentIndex = indexOfThisDelegate + 1
    }
    }

    This works perfectly with the inital static ListModel provided.

    Then, thanks to the "+" button, I can dynamically insert() a new element in the ListModel.

    BUT the scrolling down with keyboard does not work anymore, the new item seem being ignored, or disordered .

    I mean , after inserting line 1, between line 0 and 2, my focus goes down directly to line 2 hitting down key.
    for unkown reason, if I click on each line and print the model index, the model index itself seems accurate.

    this situation has not happened if I append() elements to the list (but this is not what I want :-( )


Log in to reply