diff options
author | Geir Vattekar <geir.vattekar@nokia.com> | 2011-03-23 13:40:34 (GMT) |
---|---|---|
committer | Geir Vattekar <geir.vattekar@nokia.com> | 2011-03-23 13:40:34 (GMT) |
commit | 98d65b5967d5f8a1648d73185986fabab97e692b (patch) | |
tree | 4440dbf9bbea48c27a90333981307fef734eb946 /src/declarative/graphicsitems/qdeclarativeimage.cpp | |
parent | 1e5a471645ea8c91b0a2dc0fe019f15fdc5f9127 (diff) | |
parent | 8700366079f6346ab0ba8baa624993832127188e (diff) | |
download | Qt-98d65b5967d5f8a1648d73185986fabab97e692b.zip Qt-98d65b5967d5f8a1648d73185986fabab97e692b.tar.gz Qt-98d65b5967d5f8a1648d73185986fabab97e692b.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeimage.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimage.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 2c9bde5..ed5d5fc 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -147,8 +147,8 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) /*! \qmlproperty enumeration Image::fillMode - Set this property to define what happens when the image set for the item is smaller - than the size of the item. + Set this property to define what happens when the source image has a different size + than the item. \list \o Image.Stretch - the image is scaled to fit @@ -234,6 +234,9 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) \endtable + Note that \c clip is \c false by default which means that the element might + paint outside its bounding rectangle even if the fillMode is set to \c PreserveAspectCrop. + \sa {declarative/imageelements/image}{Image example} */ QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const @@ -386,14 +389,16 @@ void QDeclarativeImage::updatePaintedGeometry() if (d->fillMode == PreserveAspectFit) { if (!d->pix.width() || !d->pix.height()) return; - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); + qreal w = widthValid() ? width() : d->pix.width(); + qreal widthScale = w / qreal(d->pix.width()); + qreal h = heightValid() ? height() : d->pix.height(); + qreal heightScale = h / qreal(d->pix.height()); if (widthScale <= heightScale) { - d->paintedWidth = width(); + d->paintedWidth = w; d->paintedHeight = widthScale * qreal(d->pix.height()); } else if(heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); - d->paintedHeight = height(); + d->paintedHeight = h; } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); |