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. QML GridView and QSortFilterProxyModel
Qt 6.11 is out! See what's new in the release blog

QML GridView and QSortFilterProxyModel

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 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.
  • A Offline
    A Offline
    artacademy
    wrote on last edited by
    #1

    Hi,

    is it not possible to use a QSortFilterProxyModel as the model of a QML GridView?

    I want the sorting to be column by column, so if a column has n rows then items with the sorting index 1 to n fill the first column. Then the item with the index (n+1) starts the next / second column.

    Here the TableView and TreeView are declared as supporting the setSortingEnabled property:
    http://qt-project.org/doc/qt-4.8/qsortfilterproxymodel.html#sorting
    But there are no examples with grid view.

    I have tried something like this:
    @ GridView {
    id: grid
    height: ..
    cellHeight: ..
    cellWidth: ..
    clip: true
    flow: GridView.TopToBottom
    snapMode: ListView.DragOverBounds
    // sortIndicatorVisible: true
    model: AbstractSortFilterProxyModel {
    source:...
    sortOrder: grid.sortIndicatorOrder
    sortRole: grid.getColumn(grid.sortIndicatorColumn).role
    }

                delegate: Item {...}
            }@
    

    Any help will be appreciated.

    Thanks

    artacademy

    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