diff -r 41300fa6a67c -r f7bc934e204c src/gui/widgets/qscrollbar.cpp --- a/src/gui/widgets/qscrollbar.cpp Tue Feb 02 00:43:10 2010 +0200 +++ b/src/gui/widgets/qscrollbar.cpp Wed Mar 31 11:06:36 2010 +0300 @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -521,6 +521,24 @@ if (const QHoverEvent *he = static_cast(event)) d_func()->updateHoverControl(he->pos()); break; +#ifndef QT_NO_WHEELEVENT + case QEvent::Wheel: { + // override wheel event without adding virtual function override + QWheelEvent *ev = static_cast(event); + int delta = ev->delta(); + // scrollbar is a special case - in vertical mode it reaches minimum + // value in the upper position, however QSlider's minimum value is on + // the bottom. So we need to invert a value, but since the scrollbar is + // inverted by default, we need to inverse the delta value for the + // horizontal orientation. + if (ev->orientation() == Qt::Horizontal) + delta = -delta; + Q_D(QScrollBar); + if (d->scrollByDelta(ev->orientation(), ev->modifiers(), delta)) + event->accept(); + return true; + } +#endif default: break; }