From c158ebbaa4ec50d01ee83177f27dad20e3027578 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 22 Jan 2011 22:13:42 +0000 Subject: [PATCH] realign the widget if it's resized svn path=/trunk/KDE/kdelibs/; revision=1216378 --- widgets/scrollwidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/widgets/scrollwidget.cpp b/widgets/scrollwidget.cpp index fb0eaa229..b7cc01d7e 100644 --- a/widgets/scrollwidget.cpp +++ b/widgets/scrollwidget.cpp @@ -1422,7 +1422,13 @@ bool ScrollWidget::eventFilter(QObject *watched, QEvent *event) d->stopAnimations(); d->adjustScrollbarsTimer->start(200); updateGeometry(); - ensureItemVisible(d->widget.data()); + if (d->widget.data()->size().width() < viewportGeometry().width() || + d->widget.data()->size().height() < viewportGeometry().height()) { + d->widget.data()->setPos(d->minXExtent(), + d->minYExtent()); + } else { + ensureItemVisible(d->widget.data()); + } } else if (watched == d->widget.data() && event->type() == QEvent::GraphicsSceneMove) { d->horizontalScrollBar->blockSignals(true); d->verticalScrollBar->blockSignals(true);