Results 1 to 9 of 9

Thread: Update GUI from another object with 2 threads.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 2 Times in 1 Post

    Default Re: Update GUI from another object with 2 threads.

    Hi, anda_skoa:

    Thank you for your prompt reply... Yes. I am transport the image as a signal argument , and I'm using Qt::BlockingQueuedConnection.
    If I use Qt:irectConnection, I always get the following error message, and nothing has been drawed on the MainWindow:
    QPixmap: It is not safe to use pixmaps outside the GUI thread
    Now, I changed my signal/slot now, and avoid using the image as a signal argument. And, I'm trying to use Qt::QueuedConnection as suggested by you, it seems all signals emitted by my code are queued there forever, and nothing has ever been drawn on GUI... During debugging, whenever I paused the program, the debugging pointer will point to the line this->m_threadGroup.join_all(); . the code patch is attached

    void LVStream::start()
    {
    this->m_threadProducer = boost::thread(&LVStream:roducer, this);
    this->m_threadConsumer = boost::thread(&LVStream::consumer, this);
    this->m_threadGroup.add_thread(&this->m_threadProducer);
    this->m_threadGroup.add_thread(&this->m_threadConsumer);
    this->m_threadGroup.join_all();
    }


    Any further suggestions please?
    Thank you very much.


    Pei



    Quote Originally Posted by anda_skoa View Post
    Any specific reason why you are using a BlockingQueuedConnection and not a normal QueuedConnection (or simply AutoConnection which results in a QueuedConnection when being used across thread boundaries)?

    Are you transporting the image as a signal argument?

    Cheers,
    _
    Last edited by jiapei100; 18th February 2013 at 04:54.
    Welcome to Vision Open
    http://www.visionopen.com

Similar Threads

  1. Replies: 17
    Last Post: 11th April 2013, 09:35
  2. How to update GUI promptly with data sent from threads
    By Eos Pengwern in forum Qt Programming
    Replies: 3
    Last Post: 7th October 2010, 11:33
  3. Replies: 4
    Last Post: 4th February 2010, 16:21
  4. Replies: 1
    Last Post: 1st February 2010, 15:13
  5. immediate update of QT object
    By db in forum Newbie
    Replies: 3
    Last Post: 14th August 2007, 12:25

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.