equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
519 case QEvent::HoverLeave: |
519 case QEvent::HoverLeave: |
520 case QEvent::HoverMove: |
520 case QEvent::HoverMove: |
521 if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) |
521 if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) |
522 d_func()->updateHoverControl(he->pos()); |
522 d_func()->updateHoverControl(he->pos()); |
523 break; |
523 break; |
|
524 #ifndef QT_NO_WHEELEVENT |
|
525 case QEvent::Wheel: { |
|
526 // override wheel event without adding virtual function override |
|
527 QWheelEvent *ev = static_cast<QWheelEvent *>(event); |
|
528 int delta = ev->delta(); |
|
529 // scrollbar is a special case - in vertical mode it reaches minimum |
|
530 // value in the upper position, however QSlider's minimum value is on |
|
531 // the bottom. So we need to invert a value, but since the scrollbar is |
|
532 // inverted by default, we need to inverse the delta value for the |
|
533 // horizontal orientation. |
|
534 if (ev->orientation() == Qt::Horizontal) |
|
535 delta = -delta; |
|
536 Q_D(QScrollBar); |
|
537 if (d->scrollByDelta(ev->orientation(), ev->modifiers(), delta)) |
|
538 event->accept(); |
|
539 return true; |
|
540 } |
|
541 #endif |
524 default: |
542 default: |
525 break; |
543 break; |
526 } |
544 } |
527 return QAbstractSlider::event(event); |
545 return QAbstractSlider::event(event); |
528 } |
546 } |