Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_image_qimagereader.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QImage>
4#include <QImageReader>
5
7void wrapper0() {
8
11reader.setFormat("png"); // same as reader.setFormat("PNG");
13
14} // wrapper0
15
16
18QImageReader reader("image.png");
19// reader.format() == "png"
21
22
23void wrapper1() {
24
27QImageReader reader("icon_64x64.bmp");
28if (reader.read(&icon)) {
29 // Display icon
30}
32
33} // wrapper1
34
35
36void wrapper2() {
37
39QImageReader reader(":/image.png");
41 qDebug() << "Size:" << reader.size();
43
44} // wrapper2
45} // src_gui_image_qimagereader
The QImageReader class provides a format independent interface for reading images from files or other...
bool supportsOption(QImageIOHandler::ImageOption option) const
void setFormat(const QByteArray &format)
Sets the format QImageReader will use when reading images, to format.
QSize size() const
Returns the size of the image, without actually reading the image contents.
QImage read()
Reads an image from the device.
\inmodule QtGui
Definition qimage.h:37
@ Format_RGB32
Definition qimage.h:46
QImageReader reader("image.png")
[1]
#define qDebug
[1]
Definition qlogging.h:164