From ec7651c5e1410638a6d1f51d3bc5c5ef7e015726 Mon Sep 17 00:00:00 2001 From: Wang Kai Date: Thu, 9 Apr 2009 04:52:38 +0000 Subject: [PATCH] Scroll fix: If scroll widget is wider/taller than the internal widget, then the internal widget should be positioned to scroll widget's top left, not bottom right. svn path=/trunk/KDE/kdelibs/; revision=951376 --- widgets/scrollwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/scrollwidget.cpp b/widgets/scrollwidget.cpp index 81047feba..faea34038 100644 --- a/widgets/scrollwidget.cpp +++ b/widgets/scrollwidget.cpp @@ -234,8 +234,8 @@ void ScrollWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF deltaPos = event->pos() - event->lastPos(); - d->widget->setPos(qBound(-d->widget->size().width()+d->scrollingWidget->size().width(), d->widget->pos().x()+deltaPos.x(), (qreal)0), - qBound(-d->widget->size().height()+d->scrollingWidget->size().height(), d->widget->pos().y()+deltaPos.y(), (qreal)0)); + d->widget->setPos(qBound(qMin((qreal)0,-d->widget->size().width()+d->scrollingWidget->size().width()), d->widget->pos().x()+deltaPos.x(), (qreal)0), + qBound(qMin((qreal)0,-d->widget->size().height()+d->scrollingWidget->size().height()), d->widget->pos().y()+deltaPos.y(), (qreal)0)); d->dragging = true; d->horizontalScrollBar->setValue(-d->widget->pos().x()/10);