summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qabstractscrollarea.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-13 11:42:54 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-13 11:42:54 (GMT)
commit3286c4d489905d27183a9ba18048c11a5af8913c (patch)
tree392cc7137ffd69b305272f672db55a73be4f1dae /src/gui/widgets/qabstractscrollarea.cpp
parent1bc1e5c0b76a92594c5254e72d25165879e753d2 (diff)
parent6b651e5f69b656c6c6fa05b6a81674a4fd56a160 (diff)
downloadQt-3286c4d489905d27183a9ba18048c11a5af8913c.zip
Qt-3286c4d489905d27183a9ba18048c11a5af8913c.tar.gz
Qt-3286c4d489905d27183a9ba18048c11a5af8913c.tar.bz2
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'src/gui/widgets/qabstractscrollarea.cpp')
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index b0d0baf..35639b7 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -1130,10 +1130,13 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e)
void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
- if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
- QApplication::sendEvent(d->hbar, e);
- else
- QApplication::sendEvent(d->vbar, e);
+ QScrollBar *const bars[2] = { d->hbar, d->vbar };
+ int idx = (e->orientation() == Qt::Vertical) ? 1 : 0;
+ int other = (idx + 1) % 2;
+ if (!bars[idx]->isVisible() && bars[other]->isVisible())
+ idx = other; // If the scrollbar of the event orientation is hidden, fallback to the other.
+
+ QApplication::sendEvent(bars[idx], e);
}
#endif