Results 1 to 4 of 4

Thread: multiple sort

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: multiple sort

    The sql-parsing approach is not that hard (at least for simple queries without union etc).

    Apart from that, yes a custom QSortFilterProxyModel that uses several columns in QSortFilterProxyModel::lessThan() will work, too. (Just don't compare only the columns given in die indexes but the ones you are interested in)

    HTH

  2. #2
    Join Date
    Aug 2007
    Posts
    275
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default Re: multiple sort

    The sql approach i think would be faster than QSortFilterProxy approach , mind you I have millions of row to sort right?

    I think in my sort I would try to sort them SQL style first then if I can't I will switch to QSortFilterProxyStyle

    any more ideas...

    baray98

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: multiple sort

    If you don't care about losing the selection and scrollbars position in the view then using the sql approach should be simpler but if you do care then you should use the proxy approach.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Multiple project files in a single directory
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 17th July 2008, 08:03
  2. QTreeWidget (Row Check, Custom Sort)
    By AaronMK in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2008, 16:55
  3. How to sort the treeWidget item according to size and date
    By santosh.kumar in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2007, 11:32
  4. How to sort a QComboBox in Qt4
    By guenthk in forum Qt Programming
    Replies: 7
    Last Post: 25th September 2006, 19:35
  5. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23

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.