Results 1 to 5 of 5

Thread: QEventLoop block...asleep?

  1. #1
    Join Date
    Mar 2015
    Posts
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60

    Default QEventLoop block...asleep?

    Hallo Everybody!
    I'm experiencing with a sneaky bug of my Qt application.

    Briefly, in my application there's a QWidget drawing a plot: its name is MyPlotWidget and it's child of one child of QMainWindow's instance.
    MyPlotWidget's refresh is triggered by a signal coming from a worker thread and connected to MyPlotWidget::refresh_slot():

    MyPlotWidget::refresh_slot()
    {
    if(isVisible())
    {
    update();
    QApplication:rocessEvents(); // This code line was added trying to fix the bug, but unsuccessfully
    }
    }

    MyPlotWidget has a redefined MyPlotWidget:aintEvent(QPaintEvent *) which execution takes about 30-40ms.
    The refresh triggering signal is emitted every 200ms.

    The problem is that after a while (minutes) the system gets frozen: MyPlotWidget::refresh_slot() is called regularly every 200ms, update() is also called, but no paintEvent!!!
    In another widget, "brother" of MyPlotWidget, there's a textual clock, which refresh is triggered by a QTimer: it gets frozen too.
    The freeze condition is reversible: it's enough to touch the screen and trigger a layout change with resulting graphical refresh.

    It's like the processing of the eventLoop is blocked. Possible?

    Reading the documentaion, i see that the QEventLoop class has a wakeUp method...how should it be used? And why?
    Why the eventLoop should be awaken?
    How could I become aware that the QEventLoop is asleep?

    Help appreciated, thank you very much!

  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: QEventLoop block...asleep?

    Since the timer stops, it is likely that event processing is not done anymore.

    Check if your slots actually return and do not sleep() or stay in a loop.,etc.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2015
    Posts
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60

    Default Re: QEventLoop block...asleep?

    Yes anda_skoa, my slot returns and doesn't get in a loop.
    The worker thread is operative, whereas the GUI seems to be frozed, but nevertheless responsive.

  4. #4
    Join Date
    Mar 2015
    Posts
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60

    Default Re: QEventLoop block...asleep?

    Hallo, i collected an element more.

    The system doesn't get frozen if the QMainWindow GUI is refreshed.
    The system has worked well without freezing for hours with a blinking label on the QMainWindow (to warn the user about a certain condition).
    It seems that keeping the QMainWindow awake, the system keeps alert too...

  5. #5
    Join Date
    Mar 2015
    Posts
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Symbian S60

    Default Re: QEventLoop block...asleep?

    It's plausible that I fixed the bug.

    I discovered that MyPlotWidget wasn't related to the QMainWindow: due to a missing parent parameter, the relationship between the two was broken.
    Activating the correct parent parameter transition, the system is going without freezing since more than 2 hours!!

Similar Threads

  1. Problems with QEventLoop
    By marnando in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 25th February 2014, 19:19
  2. QTimer while computer is asleep
    By Momergil in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2013, 18:54
  3. QEventLoop not closing
    By kuku83 in forum Qt Programming
    Replies: 4
    Last Post: 10th April 2013, 16:01
  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

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.