Results 1 to 4 of 4

Thread: Problem QSortFilterProxyModel

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Problem QSortFilterProxyModel

    Hi,

    I have a QSqlQueryModel I do a SELECT on a table with more than 1000 records and apply a QTableView.
    When using a QSortFilterProxyModel to sort by fields, only the records that are currently in QTableView are ordered (more or less about 300).
    Example, if I have a list of customers from A to Z, by clicking on the "name" to sort in descending order, they order from F to A. It's bug in QT?
    Will require reimplementation QSqlQueryModel::sort( ) and back using the SQL ORDER BY clause?

    Thank,

    Marcelo E. Geyer

  2. #2
    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: Problem QSortFilterProxyModel

    No, it's not a bug. It's just Qt doesn't download all the rows from the database for efficiency reasons. You need to call
    Qt Code:
    1. while(model->canFetchMore()) model->fetchMore();
    To copy to clipboard, switch view to plain text mode 
    to make sure all the rows are retrieved and cached.
    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.


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

    estanisgeyer (15th June 2009)

  4. #3
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: Problem QSortFilterProxyModel

    So, imagine that. Not to lose this efficiency, the method you suggest reimplemented sort and using SQL ORDER BY? Take into consideration that access can occur through the Internet.

    I have other thread open, if you could read I would be very grateful:
    http://www.qtcentre.org/forum/f-qt-p...iew-21650.html

    Thanks for reply.

    Marcelo E. Geyer

  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: Problem QSortFilterProxyModel

    Quote Originally Posted by estanisgeyer View Post
    So, imagine that. Not to lose this efficiency, the method you suggest reimplemented sort and using SQL ORDER BY? Take into consideration that access can occur through the Internet.
    I'm not sure what you mean...
    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. Replies: 19
    Last Post: 4th April 2009, 00:17
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 10:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 09:47
  4. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 11:35
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.