Results 1 to 2 of 2

Thread: Passing data from worker thread to main GUI thread

  1. #1
    Join Date
    Nov 2016
    Posts
    7
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question Passing data from worker thread to main GUI thread

    I need to pass data from worker thread (that reads from a serial port) and then pass the data to main GUI thread which needs to display the data. How can I achieve this?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,719
    Thanks
    259
    Thanked 760 Times in 750 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Passing data from worker thread to main GUI thread

    Use signals and slots or use a pointer to shared memory that you protect using a mutex. Reading the Qt documentation here and here would be a good place to start.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Passing a big data block from worker thread to GUI
    By PeterWurmsdobler in forum Qt Programming
    Replies: 6
    Last Post: 15th May 2012, 11:39
  2. Replies: 1
    Last Post: 28th March 2012, 19:58
  3. Replies: 6
    Last Post: 29th April 2009, 19:17
  4. Accessing data from a worker thread
    By steg90 in forum Qt Programming
    Replies: 20
    Last Post: 25th May 2007, 11:20
  5. Main thread - worker thread communication.
    By kikapu in forum Newbie
    Replies: 25
    Last Post: 23rd May 2007, 23:09

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.