Results 1 to 4 of 4

Thread: Qsortfilterproxymodel in a Qthread?

  1. #1
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Qsortfilterproxymodel in a Qthread?

    If the data in the source model is huge, and the new data is coming continuiously, the sort and filter consume lots of the cpu time and the foregroundcolor of tableview is blinking. In order to make the program more fluently, I am wondering to put qsortfilterproxymodel in another thread. Is that a good idea?

    Besides, after I call tableview::sortByColumn(), I want to display data in the orginal order in the source model, how could I do that? I have tried tableview::setSortingEnabled(false),Qsortfilterpro xymodel::setDynamicSortFilter(false), but didn't work.Please give me a hint.
    Jerry

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qsortfilterproxymodel in a Qthread?

    Quote Originally Posted by calmspeaker View Post
    If the data in the source model is huge, and the new data is coming continuiously, the sort and filter consume lots of the cpu time and the foregroundcolor of tableview is blinking. In order to make the program more fluently, I am wondering to put qsortfilterproxymodel in another thread. Is that a good idea?
    Unfortunately not a good idea but rather impossible. You must not touch GUI in worker threads. As long as the model is attached to any view, you cannot alter the model in a worker thread.

    Besides, after I call tableview::sortByColumn(), I want to display data in the orginal order in the source model, how could I do that? I have tried tableview::setSortingEnabled(false),Qsortfilterpro xymodel::setDynamicSortFilter(false), but didn't work.Please give me a hint.
    Remove the proxy model from between the view and the source model?
    J-P Nurmi

  3. #3
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qsortfilterproxymodel in a Qthread?

    Remove the proxy model from between the view and the source model?
    I must keep the proxy model to filter the data. Is there another idea?
    Jerry

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qsortfilterproxymodel in a Qthread?

    Quote Originally Posted by calmspeaker View Post
    I must keep the proxy model to filter the data. Is there another idea?
    How about using two proxy models; one for filtering and another for sorting.
    J-P Nurmi

Similar Threads

  1. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 14:06
  2. Spawn a QThread in another QThread
    By david.corinex in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2007, 13:54
  3. QThread exec proplem to stop...
    By patrik08 in forum Qt Programming
    Replies: 29
    Last Post: 21st May 2007, 08:51
  4. QGraphicsScene and QThread
    By tts80 in forum Qt Programming
    Replies: 5
    Last Post: 10th January 2007, 10:32
  5. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 23:51

Tags for this Thread

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.