diff options
author | Andrea Bernabei <and.bernabei@gmail.com> | 2016-05-31 14:21:44 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-07-01 06:53:22 +0000 |
commit | 240c2ef60e854575dced056d916f8a8922905e8f (patch) | |
tree | c04304bf8ca746cb350f38dc3c929cddca907c89 /src/quick/items | |
parent | 1b897195a14b63a553b139983736d8dfdd419ffd (diff) |
Flickable: fix minXExtent/minYExtent when content is smaller than view
At the moment, defining leftMargin (or topMargin) and contentWidth
(or contentHeight) so that "leftMargin+contentWidth < flickable.width"
(or topMargin+contentHeight < flickable.height) leads to widthRatio
(or heightRatio) having value != 1.
The value should, however, be 1, as the content is completely visible
inside the view, margins included.
As a sideeffect, under the assumptions described above, it will now
not be possible to scroll the leftMargin (or topMargin) out of screen,
something which was possible (and it shouldn't have) before this fix.
Task-number: QTBUG-53726
Change-Id: I22426c8038e90a2cfc7445914206eae0e781a3fb
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 32d445dbc5..b0980cd2c1 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1580,13 +1580,13 @@ qreal QQuickFlickable::minXExtent() const qreal QQuickFlickable::maxXExtent() const { Q_D(const QQuickFlickable); - return qMin<qreal>(0, width() - vWidth() - d->hData.endMargin); + return qMin<qreal>(minXExtent(), width() - vWidth() - d->hData.endMargin); } /* returns -ve */ qreal QQuickFlickable::maxYExtent() const { Q_D(const QQuickFlickable); - return qMin<qreal>(0, height() - vHeight() - d->vData.endMargin); + return qMin<qreal>(minYExtent(), height() - vHeight() - d->vData.endMargin); } void QQuickFlickable::componentComplete() |