Results 1 to 4 of 4

Thread: QFileSystemModel has no sorting

  1. #1
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QFileSystemModel has no sorting

    Hey,

    The class QFileSystemModel does not have any sorting method. The non-threaded counterpart QDirModel, however, has this feature, namely

    void setSorting ( QDir::SortFlags sort )

    The problem is that the directory from QFileSystemModel is displayed in what appears to be a completely random order.

    Any clues?

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemModel has no sorting

    What happens if you just use QAbstractItemModel::sort() on your QFileSystemModel?
    If it doesn't work then you can use QSortFilterProxyModel.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. The following user says thank you to faldzip for this useful post:

    mpi (13th June 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemModel has no sorting

    Thanks.

    I just find it strange that QDirModel has the entire range of sortings enabled as you would expect, but this class hasn't.

    Mads

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

    Default Re: QFileSystemModel has no sorting

    That's one of the reasons QDirModel is slow and QFileSystemModel is fast :-)
    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. QTable Sorting
    By mromey in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2009, 08:28
  2. Refresh QTableView after sorting
    By araglin in forum Newbie
    Replies: 4
    Last Post: 18th December 2008, 23:13
  3. Qt4: Sorting QAbstractItemVew inherited view
    By nando in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2008, 19:30
  4. Column Sorting
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 08:48
  5. [QT4] QTreeView, QAbstractItemModel and sorting
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2006, 21:16

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.