Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
9//! [0]
10QImageReader reader;
11reader.setFormat("png"); // same as reader.setFormat("PNG");
12//! [0]
13
14} // wrapper0
15
16
17//! [1]
18QImageReader reader("image.png");
19// reader.format() == "png"
20//! [1]
21
22
23void wrapper1() {
24
25//! [2]
26QImage icon(64, 64, QImage::Format_RGB32);
27QImageReader reader("icon_64x64.bmp");
28if (reader.read(&icon)) {
29 // Display icon
30}
31//! [2]
32
33} // wrapper1
34
35
36void wrapper2() {
37
38//! [3]
39QImageReader reader(":/image.png");
40if (reader.supportsOption(QImageIOHandler::Size))
41 qDebug() << "Size:" << reader.size();
42//! [3]
43
44} // wrapper2
45} // src_gui_image_qimagereader
QImageReader reader("image.png")
[1]