Skip to content
  • How can I wait all request complate?

    Unsolved General and Desktop qnetworkreply qnetworkrequest wait
    3
    0 Votes
    3 Posts
    336 Views
    J
    @JonB said in How can I wait all request complate?: main() is no good for a Qt program I gave main() as an example. To show that there is a continuous data flow to the doSth function. @JonB said in How can I wait all request complate?: But if you really want to write your code to "block" and "wait" for a response, use a local QEventLoop instance and call exec(). This is at least an "efficient" way to do it. A couple of examples on stackoverflow illustrating just this for your QNetworkReply::finished case: https://stackoverflow.com/questions/29449561/qeventloop-proper-usage https://stackoverflow.com/questions/54694312/qeventloop-wait-for-only-local-events-not-main-loop-events Thank you I will look them
  • 0 Votes
    6 Posts
    1k Views
    S
    @dev_liya said in I want to generate random number between the 0 to 1. with the interval of 1 second in qt.: but my requirement is to generate in infinite loop ad show in window. If you do an infinite loop then the event loop will not run. That means that setting the random_label or anything like that will not show on the screen as the slots cannot be handled: your infinite loop will block the event loop. The effect is that you have a frozen application. So, trust @JonB. As per your request: to wait for one second and block everything (you have been warned!): use QThread::sleep(1);
  • 0 Votes
    8 Posts
    7k Views
    F
    Ok, thanks, I think I have all information I need now.
  • how to wait for QCamera::load() ?

    Unsolved General and Desktop qcamera load wait
    5
    0 Votes
    5 Posts
    2k Views
    pauleddP
    alright, I'll try that, thanks.