diff options
Diffstat (limited to 'src/quick/items/qquickimage.cpp')
-rw-r--r-- | src/quick/items/qquickimage.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 16343774e2..840cfe15da 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -663,7 +663,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); if (!node) { d->pixmapChanged = true; - node = d->sceneGraphContext()->createInternalImageNode(); + node = d->sceneGraphContext()->createInternalImageNode(d->sceneGraphRenderContext()); } QRectF targetRect; @@ -687,7 +687,6 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) yOffset = qCeil(height() - pixHeight); switch (d->fillMode) { - default: case Stretch: targetRect = QRectF(0, 0, width(), height()); sourceRect = d->pix.rect(); @@ -699,7 +698,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) break; case PreserveAspectCrop: { - targetRect = QRect(0, 0, width(), height()); + targetRect = QRectF(0, 0, width(), height()); qreal wscale = width() / qreal(d->pix.width()); qreal hscale = height() / qreal(d->pix.height()); @@ -751,7 +750,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) targetRect = QRectF(x + xOffset, y + yOffset, w, h); sourceRect = QRectF(x, y, w, h); break; - }; + } qreal nsWidth = (hWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.width() / d->devicePixelRatio : d->pix.width(); qreal nsHeight = (vWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.height() / d->devicePixelRatio : d->pix.height(); @@ -889,4 +888,16 @@ void QQuickImage::setMipmap(bool use) By default, this property is set to false. */ +/*! + \qmlproperty int QtQuick::Image::currentFrame + \qmlproperty int QtQuick::Image::frameCount + \since 5.14 + + currentFrame is the frame that is currently visible. The default is \c 0. + You can set it to a number between \c 0 and \c {frameCount - 1} to display a + different frame, if the image contains multiple frames. + + frameCount is the number of frames in the image. Most images have only one frame. +*/ + QT_END_NAMESPACE |