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
This commit is contained in:
Wang Kai 2009-04-09 04:52:38 +00:00
parent fe02bd3735
commit ec7651c5e1

View File

@ -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);