Grouping ListView elements
-
I have a listview with group id 1 and 0. I need to group 0's and 1's separately. Any idea how to do it? Do I need to create another ListModel and add these elements accordingly or can i re-arrange my current ListView.
Thanks in advance
-
I need to sort them in one order, parameter with id 0 at first and then parameter with id 1. Thanks
-
am unable to get the logic to solve it with index. for ex. i have 6 elements with id 0 1 2 2 1 0 in the following manner i need to display it as 0 0 1 1 2 2. I hope now it is clear
-
Sure, that is very possible. Use a [[doc:QSortFilterProxyModel]] between your model and your view, and sort on the appropriate role and column. If you need to sort within the groups too, you will have to resort to subclassing and reimplementing the virtual bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const function.
-
Am working completely in qml so am not used to these functions.. do u have an example
-
Its toooo complicated for me as a beginner.
-
ya I tried to use that but it does not work according to my rule:(