Results 1 to 5 of 5

Thread: QWheelEvent: checking if wheel has stopped

  1. #1
    Join Date
    Jan 2011
    Posts
    55
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QWheelEvent: checking if wheel has stopped

    I have a QWheelEvent and I use it to zoom a QGLWidget scene in and out. Is it possible to intercept when the mouse wheel has stopped, something similar to mouseReleaseEvent(QMouseEvent *event) ?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWheelEvent: checking if wheel has stopped

    The wheel will have stopped when you stop receiving wheel events. Just run a timer that is reset in every wheel event and when it times out, you'll know the user stopped scrolling.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    papillon (30th September 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    55
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QWheelEvent: checking if wheel has stopped

    Thanks wysota, I have difficulties understanding this.

    Shall I actually timer->start(0) in my main loop, and call again timer->start(0) in the wheelevent routine to restart the timer again?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWheelEvent: checking if wheel has stopped

    No, zero timeout timer is not correct. Set the timeout to something like 500ms (or less if you want the mechanism to be more responsive at the cost of having some false positives).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    papillon (30th September 2011)

  7. #5
    Join Date
    Jan 2011
    Posts
    55
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QWheelEvent: checking if wheel has stopped

    Thanks wysota, infact now it's working perfectly!

Similar Threads

  1. Pass event (QWheelEvent) to a specific widget
    By stefanadelbert in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2021, 03:10
  2. QSS stopped working when using QProxyStyle
    By mentalmushroom in forum Qt Programming
    Replies: 1
    Last Post: 2nd September 2011, 12:00
  3. Replies: 2
    Last Post: 19th July 2011, 10:06
  4. Create a QWheelEvent and pass it to a widget's wheelEvent
    By almagest in forum Qt Programming
    Replies: 3
    Last Post: 20th December 2010, 13:58
  5. QResource Stopped Working
    By JPNaude in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2008, 12:26

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.