Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableView sort by ALL Column,not by single Column
Forum Updated to NodeBB v4.3 + New Features

QTableView sort by ALL Column,not by single Column

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.8k 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
    noregister
    wrote on last edited by
    #1

    I want My QTableView sort by ALL Column,not by single Column,How can I do this?
    for example:

    before sort
    @

    1 | 2 | 3

    4 | 5 | 6

    7 | 8 |
    @

    After sort:
    @

    8 | 7 | 6

    5 | 4 | 3

    2 | 1 |
    @

    1 Reply Last reply
    0
    • N Offline
      N Offline
      noregister
      wrote on last edited by
      #2

      OK,It seems that Qt do not surpport sort by multiple columns default.
      But can subclass QSortFilterProxy and impliments yourself.

      refer:

      "Is it possible to sort on multiple columns in QTableView using QSortFilterProxyModel":http://qt-project.org/forums/viewthread/1349

      "QSortFilterProxyModel sort multiple columns":http://stackoverflow.com/questions/10893843/qsortfilterproxymodel-sort-multiple-columns

      "MultisortTableView":https://github.com/dimkanovikov/MultisortTableView

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobias.hunger
        wrote on last edited by
        #3

        That is not a table then, but a simple list. How about implementing it as an alternate implementation of a list view?

        1 Reply Last reply
        0
        • N Offline
          N Offline
          noregister
          wrote on last edited by
          #4

          listview is not for my application,
          I use some tableview features,such as:
          setColumnWidth
          setRowHeight
          setGridStyle
          and itemDelegate and customlize tablemodel

          And I found the link above is sort multiple columns but not multiple columns as one list
          and subclass QSortFilterProxy to achive is very difficulty for such sort policy

          so at last, I manage to sort my Model Data myself,and reset the tableview.

          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