Results 1 to 3 of 3

Thread: Adding threads to a Model-Proxy-View arrangement

  1. #1
    Join Date
    Oct 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Adding threads to a Model-Proxy-View arrangement

    Hi,
    I have a program which is a QStandardItemModel connected to a QTableView through a QSortFilterProxyModel. I've subclassed the Model and the Proxy to perform filtering on the data, though all the actual computation occurs in the Model. In the future, I'm going to rewrite the Model to make it more efficient, basing it off the QAbstractItemModel so that I can use my own data structures.

    So that's the background. What I would like to do is add a 'worker' thread in somewhere to get rid of the delay which occurs when the worker thread is processing large sets of data. If the user provides new input, the worker thread would stop and restart with the new input instead of finishing work which is useless.

    My question is how should I add threaded support? I've read the docs and understand the concept of threads, but I'm unsure how I should organise the program.

    Should I create a 'Worker' class which the QStandardItemModel will use?

    Any suggestions will be appreciated! Thanks all.

  2. #2
    Join Date
    Oct 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding threads to a Model-Proxy-View arrangement

    Take a look at Mandelbrot example.

  3. #3
    Join Date
    Oct 2010
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding threads to a Model-Proxy-View arrangement

    Thanks Cucumber. The Mandelbrot example is a good one, but I'm more curious about working with threads and the model-view concept. Are there any examples of that out there I wonder?

Similar Threads

  1. View and Model in different threads
    By alextai in forum Qt Programming
    Replies: 0
    Last Post: 3rd October 2010, 00:26
  2. Proxy model / view update problem
    By pascal123 in forum Qt Programming
    Replies: 4
    Last Post: 9th June 2010, 01:02
  3. Replies: 1
    Last Post: 18th November 2009, 23:21
  4. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  5. Filter Proxy Model to Autoupdate View
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 1st June 2006, 20:32

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.