[Qt-interest] Question regarding QTimer
Vesa Shmuel Peltonen
vesashmuel at gmail.com
Wed Mar 16 16:29:00 CET 2011
Yes, I know :)
The timer is started only once, when mouse is pressed. I expected, that the
timer will timeout after 150 ms even when the mouse is still down, but it is
not.
So, the sequence is this:
1. Mouse press down
-> timer started (I tried even 0 with timeout)
2. Mouse hold down for long time
3. Mouse released
=> timeout slot is called only here (even with 0 timeout).
As I said, tried this only on S^3, maybe platform specific behavior?
Thanks again,
Vesa
On Wed, Mar 16, 2011 at 5:16 PM, Atlant Schmidt
<aschmidt at dekaresearch.com>wrote:
> 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/39cfe8d4/attachment.html
More information about the Qt-interest-old
mailing list