diff options
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 33c12993d7..fadfd5be73 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1316,7 +1316,7 @@ int QImage::height() const Returns the size of the image, i.e. its width() and height(). - \sa {QImage#Image Information}{Image Information} + \sa {QImage#Image Information}{Image Information}, deviceIndependentSize() */ QSize QImage::size() const { @@ -1449,7 +1449,7 @@ qreal QImage::devicePixelRatio() const high-DPI image rather than a large image (see \l{Drawing High Resolution Versions of Pixmaps and Images}). - \sa devicePixelRatio() + \sa devicePixelRatio(), deviceIndependentSize() */ void QImage::setDevicePixelRatio(qreal scaleFactor) { @@ -1465,6 +1465,22 @@ void QImage::setDevicePixelRatio(qreal scaleFactor) } /*! + Returns the size of the pixmap in device independent pixels. + + This value should be used when using the pixmap size in user interface + size calculations. + + The return value is equivalent to pixmap.size() / pixmap.devicePixelRatio(), +*/ +QSizeF QImage::deviceIndependentSize() const +{ + if (!d) + return QSizeF(0, 0); + return QSizeF(d->width, d->height) / d->devicePixelRatio; +} + + +/*! \since 5.10 Returns the image data size in bytes. |