Results 1 to 6 of 6

Thread: QSortFilterProxyModel : sort columns

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel : sort columns

    Thanks for the answer.

    If I understand what you mean, you advise me to build one other QSortFilterProxyModel above the current one, where I swap data from row to column ?
    And How can I swap it again to display columns as columns and rows as rows ?

    This seems very complicated for the simple sort I have to do. My QSortFilterProxyModel has some other operations and I fear to get some trouble with this method...

    Does it exist any method to move columns in the QSortFilterProxyModel, and edit mapping ?
    Last edited by Kouillo; 12th September 2012 at 08:32.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QSortFilterProxyModel : sort columns

    Since you have a custom model anyway why not do the sorting there?

  3. #3
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel : sort columns

    I do not find how to move columns in the QSortFilterProxyModel.
    I already make a sort for the rows.


    Quote Originally Posted by Kouillo View Post
    This seems very complicated for the simple sort I have to do. My QSortFilterProxyModel has some other operations and I fear to get some trouble with this method...

    Does it exist any method to move columns in the QSortFilterProxyModel, and edit mapping ?

  4. #4
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSortFilterProxyModel : sort columns

    Nope, what I am suggesting that in the main model, you have the transposed matrix which you want to show. This is the one which operates on data. The next one on top of it merely transposes the transposed matrix and makes it as you want to see. It means making a few models. A model creation doesn't take too much time.
    However, I think I am unable to express it clearly.
    You can as well follow Chris advice and do the sorting in your model itself. At the row button click, get all the rows and their data and emit signals like columnsAboutToBeMoved(), columnsMoved, etc.

Similar Threads

  1. customize a QSortFilterProxyModel with additional columns
    By winkle99 in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2011, 04:17
  2. Sort huge data use QSortFilterProxyModel
    By jiaorenjie in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2011, 02:56
  3. How to sort columns by "icon"?
    By youkai in forum Qt Programming
    Replies: 3
    Last Post: 31st July 2008, 16:25
  4. QSortFilterProxyModel - always sort 0 to the bottom
    By ironstorm in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2008, 20:38
  5. QSortFilterProxyModel - sort strings
    By DPinLV in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2006, 01:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.