[Qt-interest] Question regarding QTimer

Atlant Schmidt aschmidt at dekaresearch.com
Wed Mar 16 16:16:50 CET 2011


Vesa:

  You know that QTimers are "retriggerable", right? That is,
  if you do an m_timer->start(150) multiple times, each
  within 150 ms of the previous one, the timer doesn't time-out
  until 150 ms after the *LAST* call to start().

  Perhaps you're getting more MouseButtonPress events
  than you think and they're re-triggering your timer? Maybe
  you can place some debugging print or some such in the
  path that start()s the timer?

                                      Atlant

________________________________
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Vesa Shmuel Peltonen
Sent: Wednesday, March 16, 2011 10:39
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] Question regarding QTimer

Hello all,

I've simple question. I'm trying to start a timer when mouse press event is received on eventfilter:

xxx::eventFilter(QObject *object, QEvent *event)

{



    if ( event->type() == QEvent::MouseButtonPress )

    {



           m_timer->start(150); // msec

...








It seems that the timer timeouts always only after the mouse is released, even if the mouse press is very long (many seconds).

Is this known behavior and is there way to overcome the problem? Is the system process blocking the application thread during the mouse press, so even if the timeout should have happen much earlier, the slot is called only after the mouse is released?

Btw, my environment is Qt 4.7.2 on S^3 device. I've not tested the behavior on other platforms.






Thanks,

Vesa


Click here<https://www.mailcontrol.com/sr/xVgY2I1OSnbTndxI!oX7UiNQo6b55PW6E6Mk6PJ6lylK0Gxzl8M9JqgO7Csb+Br3JfPdjQoD3dvZM0Vr2cPI!w==> to report this email as spam.

________________________________
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110316/7e1a0b20/attachment.html 


More information about the Qt-interest-old mailing list