Important: Please read the Qt Code of Conduct -

QMl keyhandling issues

  • i have two listviews in qml.from one listview i reach to the next.for touch it is working fine.but i have to make this working for non touch also.the issue is the first list view is working fine with key up and down while the second one is not working with keys.can anybody knows how to resolve this issue??

    Thanks in advance

    Adnan Shoukat

  • It's obviously a focus problem. One of your listviews has a focus, and another has not. Only one item can have active focus at the same time.

    One solution is to use KeyNavigation attached property. If you use it, then you can move the active focus from one listview to another by pressing eg. tab key, or eg. arrow keys.

    Here is an example:

    @ListView {
    id: list1
    focus: true list2
    KeyNavigation.right: list2

    ListView {
    id: list2
    ... list1
    KeyNavigation.left: list1

Log in to reply