If the currently assigned device is a file, or if setFileName() has been called, this function returns the name of the file QImageWriter writes to. Returns a human readable description of the last error that occurred. QString QImageWriter:: errorString() const See also ImageWriterError and errorString(). Returns the type of error that last occurred. QImageWriter::ImageWriterError QImageWriter:: error() const Returns the device currently assigned to QImageWriter, or nullptr if no device has been assigned. See also write(), setDevice(), and setFormat(). Returns true if QImageWriter can write the image i.e., the image format is supported and the assigned device is open for reading. QImageWriter:: ~QImageWriter()ĭestructs the QImageWriter object. Before writing, you must call setFormat() to set an image format, then setDevice() or setFileName(). QImageWriter:: QImageWriter()Ĭonstructs an empty QImageWriter object. QImageWriter:: QImageWriter( QIODevice * device, const QByteArray & format)Ĭonstructs a QImageWriter object using the device device and image format format. If format is not provided, QImageWriter will detect the image format by inspecting the extension of fileName. Member Function Documentation QImageWriter:: QImageWriter(const QString & fileName, const QByteArray & format = QByteArray())Ĭonstructs a QImageWriter objects that will write to a file with the name fileName, using the image format format. QImageWriter supports all built-in image formats, in addition to any image format plugins that support writing. You can then call error() to find the type of error that occurred, or errorString() to get a human readable description of what went wrong.Ĭall supportedImageFormats() for a list of formats that QImageWriter can write. If any error occurs when writing the image, write() will return false. Call write() to write the image to the device. canWrite() returns true if QImageWriter can write the image (i.e., the image format is supported and the device is open for writing). You can then set several options, such as quality (by calling setQuality()). Pass either a file name or a device pointer, and the image format to QImageWriter's constructor. To store an image, you start by constructing a QImageWriter object. If you do not need such options, you can use QImage::save() or QPixmap::save() instead. QImageWriter supports setting format specific options, such as compression level and quality, prior to storing the image. SupportsOption(QImageIOHandler::ImageOption option) const SetTransformation(QImageIOHandler::Transformations transform) SetText(const QString & key, const QString & text) SetProgressiveScanWrite(bool progressive) QImageWriter(QIODevice * device, const QByteArray & format) QImageWriter(const QString & fileName, const QByteArray & format = QByteArray())