Results 1 to 3 of 3

Thread: Interrupting QEventLoop with signals ?

  1. #1
    Join Date
    Feb 2014
    Posts
    15
    Thanks
    3

    Default Interrupting QEventLoop with signals ?

    I'm reading a file and using a progress bar.

    Qt Code:
    1. while(!in.atEnd()){
    2. //work
    3. ui->progressBar->setValue(in.pos());
    4. qApp->processEvents(QEventLoop::ExcludeUserInputEvents); // "disables" gui
    5. }
    To copy to clipboard, switch view to plain text mode 

    During this event, there is the possibility that a signal is emitted, the issue is that I can't detect it because of the QEventLoop.

  2. #2
    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: Interrupting QEventLoop with signals ?

    Quote Originally Posted by oldFox64 View Post
    During this event, there is the possibility that a signal is emitted, the issue is that I can't detect it because of the QEventLoop.
    No, the cause must be different.

    Calling QCoreApplication:rocessEvents() is basically like having a nested event loop, so everything is processed as usual.

    Cheers,
    _

  3. #3
    Join Date
    Feb 2014
    Posts
    15
    Thanks
    3

    Default Re: Interrupting QEventLoop with signals ?

    Yeah, the cause was mine, I didn't throw the signals properly.

    Now, how I could stop the loop if my signal has been emitted?

    Ty.

    solution:

    I handdle the signal, I close my inputs, then I will add to the loop the condition of checking the inputs.
    Last edited by oldFox64; 4th April 2014 at 11:39.

Similar Threads

  1. QEventLoop not closing
    By kuku83 in forum Qt Programming
    Replies: 4
    Last Post: 10th April 2013, 16:01
  2. QEventLoop in QApplication
    By Qiieha in forum Qt Programming
    Replies: 1
    Last Post: 22nd May 2012, 19:08
  3. Interrupting script evaluation of QScriptEngine
    By Haqim in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 14:38
  4. How to use QEventLoop?
    By MorrisLiang in forum Newbie
    Replies: 3
    Last Post: 13th May 2010, 16:23
  5. qprocess or qeventloop
    By knishaq in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2009, 10:14

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.