Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Sorting in QtQuick 1.1 GridView
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Sorting in QtQuick 1.1 GridView

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    napajejenunedk0
    wrote on 30 Jul 2013, 08:59 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on 7 Aug 2013, 12:44 last edited by
      #2

      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.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        napajejenunedk0
        wrote on 7 Aug 2013, 14:07 last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved