summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/qimagewriter/main.cpp
blob: ffb0b8eda58258997a720bd1ed468befd27e2864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2018 Samuel Gaist <samuel.gaist@idiap.ch>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>

void wrapper() {
//! [0]
QString imagePath(QStringLiteral("path/image.jpeg"));
QImage image(64, 64, QImage::Format_RGB32);
image.fill(Qt::red);
{
    QImageWriter writer(imagePath);
    writer.write(image);
}

QFile::rename(imagePath,
              QStringLiteral("path/other_image.jpeg"));
//! [0]

} // wrapper