diff options
author | Nils Jeisecke <jeisecke@saltation.de> | 2013-07-30 13:59:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-31 13:26:21 +0200 |
commit | 1a90b94afabc064048a88b4a5fc6cd886694c061 (patch) | |
tree | 230d6e139adafce5f2033d36f6d93ca7122f0c78 /src | |
parent | 53371a557f791edc2d64c7b21cc1a5bab09afe90 (diff) |
Correctly update flickable visibleArea.heightRatio when geometry changes
Without this fix the visibleArea.heightRatio and widthRatio values
were only updated on geometry changes when flicking was active.
So when setting the flickable geometry to the content geometry and
thereby disabling flicking the ratios were not updated.
This could for example cause wrong scrollbar renderings.
The ratios are now also calculated directly after accessing the
visibleArea property for the first time.
The new autotest covers both problems.
Change-Id: I54ba606524557fb328a198c312c1f65eb125c5a3
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 374d4397ff..46f95f16cb 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -881,8 +881,10 @@ QQuickItem *QQuickFlickable::contentItem() QQuickFlickableVisibleArea *QQuickFlickable::visibleArea() { Q_D(QQuickFlickable); - if (!d->visibleArea) + if (!d->visibleArea) { d->visibleArea = new QQuickFlickableVisibleArea(this); + d->visibleArea->updateVisible(); // calculate initial ratios + } return d->visibleArea; } @@ -1518,8 +1520,7 @@ void QQuickFlickable::geometryChanged(const QRectF &newGeometry, bool changed = false; if (newGeometry.width() != oldGeometry.width()) { - if (xflick()) - changed = true; + changed = true; // we must update visualArea.widthRatio if (d->hData.viewSize < 0) { d->contentItem->setWidth(width()); emit contentWidthChanged(); @@ -1531,8 +1532,7 @@ void QQuickFlickable::geometryChanged(const QRectF &newGeometry, } } if (newGeometry.height() != oldGeometry.height()) { - if (yflick()) - changed = true; + changed = true; // we must update visualArea.heightRatio if (d->vData.viewSize < 0) { d->contentItem->setHeight(height()); emit contentHeightChanged(); |