Results 1 to 2 of 2

Thread: Scrolling the mouse over a QScrollbar

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Scrolling the mouse over a QScrollbar

    Why does mouse-scrolling over a QScrollBar emit a SliderChanged action, not a SliderSingleStepAdd/Sub action? Seems a little odd. Are there any better options for changing this than inheriting from QScrollbar?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Scrolling the mouse over a QScrollbar

    What do you mean by "mouse-scrolling over a QScrollbar"? Do you mean grabbing the slider and moving it? Or putting the cursor on the bar and rolling the mouse wheel?

    If you mean the mouse wheel, a single "click" of the mouse wheel is not the same as a mouse click on the up / down arrows at the end of the scrollbar. The wheel generates QWheelEvent events, not mouse clicks. QScrollbar handles the wheelEvent() and maps these into slider position changes. If you don't like this, derive your own class from QScrollbar and override wheelEvent() to implement your own (nonstandard and probably confusing to the user) behavior.

Similar Threads

  1. scrolling graphicsWidget using mouse
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 19th December 2014, 08:37
  2. Replies: 0
    Last Post: 4th January 2013, 04:59
  3. Scrolling on Mouse Wheel
    By penny in forum Qt Programming
    Replies: 4
    Last Post: 7th April 2011, 07:30
  4. Replies: 3
    Last Post: 9th March 2010, 09:37
  5. QScrollbar show scratching on scrolling on any widget
    By santosh.kumar in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2008, 05:58

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.