[SOLVED] Sorting in QtQuick 1.1 GridView



  • I've used a QSortFilterProxy model to sort a given model and passed the QSortFilterProxy model to the QML's GridView but only the filterRow member function gets called e.g. only filtering works. The sorting - lessThan member function, does not get called. Looking in Qt Widgets, QTableView has a setSortingEnabled member function that unlocks the sorting if a QSortFilterModel is provided to it. Is there the same way to unlock sorting in QML's GridView, since I didn't found such?



  • As far as I can tell the TreeView simply calls the "sort"-function on the proxy model every time you click a header or when you call setSortingEnabled. In other words you will have to expose that function to QML in order to mimic the TreeView behaviour. You probably also want to use setDynamicSortFilter in order for the proxy model to stay in sync.



  • Yes, I've already resolved the case by just calling the sort of the QSortFilterProxy model since it was not enough just to reimplement the lessThan() member function. Forgot to mark the topic as solved.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.