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>
This commit is contained in:
Eirik Aavitsland 2018-01-12 14:21:19 +01:00 committed by Allan Sandfeld Jensen
parent 13c71ac816
commit f0cad9b612

View File

@ -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 The loader attempts to read the image using the specified \a
format. If the \a format is not specified (which is the default), 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. 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. and returns \c false.
The loader attempts to read the image using the specified \a format, e.g., 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 PNG or JPG. If \a format is not specified (which is the default), it is
loader probes the file for a header to guess the file format. 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 The file name can either refer to an actual file on disk or to one
of the application's embedded resources. See the 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 Constructs a QImage from the first \a size bytes of the given
binary \a data. The loader attempts to read the image using the 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), 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. the loader probes the data 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 If \a format is specified, it must be one of the values returned by
file for a header to determine the file format. If \a format is specified, QImageReader::supportedImageFormats().
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. If the loading of the image fails, the image returned will be a null image.