summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2018-01-12 14:21:19 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-15 15:50:28 +0000
commitf0cad9b612d0bc9d11819960f85c2f99c3dbebde (patch)
tree57482651052f06aad01268a29234873afdb243c0 /src/gui
parent13c71ac816ce2f7fe864d6213b790a424d9a1664 (diff)
Doc: Clarify auto detection of file format in QImage
The documentation of the QImage file loader methods contained a simplified and somewhat misleading description of the format auto detection algorithm. Fix up the language and link to the detailed explanation. Task-number: QTBUG-51596 Task-number: QTBUG-65438 Change-Id: I33ebc81c78e685c7ec4803fa56efd4e9cbc4eda5 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 43b77a862d..bd10012bf6 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -931,7 +931,8 @@ QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Forma
The loader attempts to read the image using the specified \a
format. If the \a format is not specified (which is the default),
- the loader probes the file for a header to guess the file format.
+ it is auto-detected based on the file's suffix and header. For
+ details, see {QImageReader::setAutoDetectImageFormat()}{QImageReader}.
If the loading of the image failed, this object is a null image.
@@ -3389,8 +3390,9 @@ void QImage::rgbSwapped_inplace()
and returns \c false.
The loader attempts to read the image using the specified \a format, e.g.,
- PNG or JPG. If \a format is not specified (which is the default), the
- loader probes the file for a header to guess the file format.
+ PNG or JPG. If \a format is not specified (which is the default), it is
+ auto-detected based on the file's suffix and header. For details, see
+ {QImageReader::setAutoDetectImageFormat()}{QImageReader}.
The file name can either refer to an actual file on disk or to one
of the application's embedded resources. See the
@@ -3457,14 +3459,10 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
Constructs a QImage from the first \a size bytes of the given
binary \a data. The loader attempts to read the image using the
specified \a format. If \a format is not specified (which is the default),
- the loader probes the file for a header to guess the file format.
- binary \a data. The loader attempts to read the image, either using the
- optional image \a format specified or by determining the image format from
- the data.
-
- If \a format is not specified (which is the default), the loader probes the
- file for a header to determine the file format. If \a format is specified,
- it must be one of the values returned by QImageReader::supportedImageFormats().
+ the loader probes the data for a header to guess the file format.
+
+ If \a format is specified, it must be one of the values returned by
+ QImageReader::supportedImageFormats().
If the loading of the image fails, the image returned will be a null image.