Results 1 to 5 of 5

Thread: Scrolling on Mouse Wheel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    33
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7

    Default Re: Scrolling on Mouse Wheel

    Thanks for the reply.
    How do i call the default wheelevent? Isn't it called automatically when i move the mouse wheel?

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17
    Thanked 90 Times in 88 Posts

    Default Re: Scrolling on Mouse Wheel

    You need to call the base class implementation. Otherwise you are overriding its functionality. Your GraphWidget inherits from QGraphicsView?

    Then it would look like this:

    Qt Code:
    1. void GraphWidget::wheelEvent(QWheelEvent *event)
    2. {
    3. if (event->modifiers().testFlag(Qt::ControlModifier))
    4. {
    5. scaleView(pow((double)2, -event->delta() / 240.0));
    6. } else {
    7. QGraphicsView::wheelEvent(event);
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    HIH

    Johannes

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

    penny (7th April 2011)

  4. #3
    Join Date
    Dec 2010
    Posts
    33
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7

    Default Re: Scrolling on Mouse Wheel

    Thank you so much!! It works properly now..

Similar Threads

  1. QDial disabling key scroll and mouse wheel scroll
    By ldg20 in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2010, 00:05
  2. Replies: 3
    Last Post: 9th March 2010, 10:37
  3. combining wheel events
    By mcarter in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2010, 06:59
  4. wheel event problem
    By bhogasena in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2009, 20:11
  5. Wheel and QTest
    By skrzypu in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2008, 21:05

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
  •  
Qt is a trademark of The Qt Company.