Results 1 to 2 of 2

Thread: "Blocking" a QThread until a signal has arrived

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: "Blocking" a QThread until a signal has arrived

    Maybe there is an easier way: QIODevice, the base class of QProcess has a waitForReadyRead() function that can be used to blockingly wait for the readyRead() signal emit.

    Alternatively you could start the thread's event loop when you "wait" and stop it when you are done
    Qt Code:
    1. void get_something()
    2. {
    3. // wait in event loop
    4. exec();
    5. }
    6.  
    7. void set_something()
    8. {
    9. // stop event loop
    10. quit();
    11. }
    To copy to clipboard, switch view to plain text mode 

    And for completeness: the "missing" function in your original code is QThread::eventDispatcher().

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    tuli (14th April 2019)

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 10:02
  2. Replies: 3
    Last Post: 16th March 2015, 07:31
  3. Replies: 4
    Last Post: 26th June 2008, 18:41
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. Signal defined in "a.h" can not emit in "b.cpp"
    By Shawn in forum Qt Programming
    Replies: 9
    Last Post: 21st May 2007, 16:55

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.