Results 1 to 3 of 3

Thread: proper method for dynamically creating QThreads

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default proper method for dynamically creating QThreads

    I have a GUI which displays data traces using opengl. To make everything work nice, I've moved the code which updates the data to another thread. So I have something like this:

    Qt Code:
    1. class DataObjectGL : QWidgetGL {
    2. public:
    3. DataUpdate : QObject
    4. }
    5.  
    6. DataObjectGL :: DataObjectGL() {
    7.  
    8. dataUpdate = new DataUpdate();
    9. dataUpdate->moveToThread(&GUIDataProcessThread);
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

    I would like to generate an arbitrary (small) number of these objects depending on the GUI layout.

    I have found two ways of signalling the existence of new data. If I use a signal connected to a slot in dataUpdate, everything works great. However, for efficiency's sake, I'd like to use a QWaitCondition. However, that means that the data processing code must run in an infinite loop in dataUpdate. And when I start this loop (by connecting to the thread start() signal), the thread only gets to start the first object's loop. Am I misunderstanding QWaitCondition? Can multiple QWaitConditions not run in a single thread?

    thanks!
    Last edited by high_flyer; 18th May 2011 at 10:22. Reason: code tags

Similar Threads

  1. Dynamically creating buttons from Xml file
    By chandru@080 in forum Newbie
    Replies: 5
    Last Post: 25th November 2010, 11:34
  2. Replies: 3
    Last Post: 15th April 2010, 14:26
  3. Creating dock widget as tab dynamically
    By vidyadhar in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2009, 13:03
  4. QWizard creating objects dynamically
    By afflictedd2 in forum Qt Programming
    Replies: 5
    Last Post: 24th March 2009, 16:43
  5. Creating object of other class in Run() method
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:05

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.