Nominate our 2022 Qt Champions!

Sorting QML treeview's only root level Item.

  • Hi,
    I have model in c++ created using QAbstartctItemModel. I'm also using QSortFilterProxyModel for filtering and sorting purpose. This proxy molel is exposed to QML as a context property and used as model for QML treeview.
    As there is no column based structure in QML, instead we have columns created using user defined roles in c++ model.

    i'm able to sort the selected column according to role but its sorting all the levels of tree either in Ascending or descending order. Documentation also says that it will sort childrens recursively.

          But i need take only root level item into consideration while sorting and order of children within root level item should not be changed.

    Is there any one know how to achieve this??

    Thanks !

Log in to reply