src/gui/widgets/qabstractscrollarea.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 22 79de32ba3296
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     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 **
  1132 */
  1132 */
  1133 #ifndef QT_NO_WHEELEVENT
  1133 #ifndef QT_NO_WHEELEVENT
  1134 void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
  1134 void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
  1135 {
  1135 {
  1136     Q_D(QAbstractScrollArea);
  1136     Q_D(QAbstractScrollArea);
  1137     QScrollBar *const bars[2] = { d->hbar, d->vbar };
  1137     if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
  1138     int idx = (e->orientation() == Qt::Vertical) ? 1 : 0;
  1138         QApplication::sendEvent(d->hbar, e);
  1139     int other = (idx + 1) % 2;
  1139     else
  1140     if (!bars[idx]->isVisible() && bars[other]->isVisible())
  1140         QApplication::sendEvent(d->vbar, e);
  1141         idx = other;   // If the scrollbar of the event orientation is hidden, fallback to the other.
       
  1142 
       
  1143     QApplication::sendEvent(bars[idx], e);
       
  1144 }
  1141 }
  1145 #endif
  1142 #endif
  1146 
  1143 
  1147 #ifndef QT_NO_CONTEXTMENU
  1144 #ifndef QT_NO_CONTEXTMENU
  1148 /*!
  1145 /*!