Results 1 to 4 of 4

Thread: lost signals ?

  1. #1
    Join Date
    Jan 2008
    Posts
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default lost signals ?

    guys i have a scenario in which i send signal every certain amount of time delay.
    Qt Code:
    1. QTimer *timer = new QTimer(this);
    2. connect(timer, SIGNAL(timeout()), this, SLOT(drawDemo()));
    3. timer->start(30);
    To copy to clipboard, switch view to plain text mode 

    i receive this signal on a slot which do a hards drawing.sometimes when the slot takes very long time more than the period of the signal delay time

    Qt Code:
    1. void drawDemo()
    2. {
    3. //heavy drawing
    4. }
    To copy to clipboard, switch view to plain text mode 

    my question is what happens when the time comes of the signal ??
    i mean does the qt sense the signal ? o it will be busy finish the slot?
    and wait will happen if it will handle the signal while the slot is doing ?
    do the qt has a queue for lost signals ? or it just discard ?or what happens exactly in that scenario ?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lost signals ?

    Since everything happens in the same thread the timer won't fire while drawDemo. If drawDemo takes 300ms then the timer will fire 10 times(one after another) after drawDemo ends.
    The solution is to disable the timer when drawDemo enters and enable it back when it exists (disable it at the beginning and enable it at the end).

  3. #3
    Join Date
    Jan 2008
    Posts
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lost signals ?

    so it queued the signals..or that just happens with the timer signal ?

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: lost signals ?

    timers or threads posting events in another thread.

Similar Threads

  1. Problem with SpinBox signals and slots
    By ramstormrage in forum Newbie
    Replies: 4
    Last Post: 2nd May 2008, 02:45
  2. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 23:18
  3. signals and slots in plugins
    By anderl in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2007, 14:57
  4. Replies: 2
    Last Post: 27th February 2007, 22:06
  5. KDE Signals
    By chombium in forum KDE Forum
    Replies: 1
    Last Post: 25th January 2006, 19:45

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.