summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-16 08:56:38 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-16 09:26:28 (GMT)
commitfa175f7c09e6e664f347ac9804b1a7db1d997ef2 (patch)
tree990ee11e1ab67642d18233d442154dca71566bcc
parent07f724cd5abd0548fb32ed3469bde113daf028c4 (diff)
downloadQt-fa175f7c09e6e664f347ac9804b1a7db1d997ef2.zip
Qt-fa175f7c09e6e664f347ac9804b1a7db1d997ef2.tar.gz
Qt-fa175f7c09e6e664f347ac9804b1a7db1d997ef2.tar.bz2
QScrollArea: Excessive scrolling in focusNextPrevChild()
We were scrolling horizontally even though the widget already fit the visible area horizontally. And conversely for vertical scrolling. Improves commit f1e92b2fdf6b6fd8aca0d05176c647dd68e21baa. Reviewed-by: Thierry Task-number: QTBUG-9425
-rw-r--r--src/gui/widgets/qscrollarea.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp
index 6b81d9f..38e799e 100644
--- a/src/gui/widgets/qscrollarea.cpp
+++ b/src/gui/widgets/qscrollarea.cpp
@@ -482,14 +482,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2);
else if (focusRect.right() > visibleRect.right())
d->hbar->setValue(focusRect.right() - d->viewport->width());
- else
+ else if (focusRect.left() < visibleRect.left())
d->hbar->setValue(focusRect.left());
if (focusRect.height() > visibleRect.height())
d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2);
else if (focusRect.bottom() > visibleRect.bottom())
d->vbar->setValue(focusRect.bottom() - d->viewport->height());
- else
+ else if (focusRect.top() < visibleRect.top())
d->vbar->setValue(focusRect.top());
}