Doc: compile qimagewriter snippet

Done-with: Nico Vertriest <nico.vertriest@qt.io>
Task-number: QTBUG-81486
Change-Id: Ibb4087d7035c3061b2980b317ab4280fa38aab50
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This commit is contained in:
Paul Wicking 2020-08-31 14:35:25 +02:00
parent 45211e947a
commit 5ee39fc7c9
3 changed files with 21 additions and 18 deletions

View File

@ -47,25 +47,20 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
void wrapper() {
//! [0]
QString imagePath(QStringLiteral("path/image.jpeg"));
QImage image(64, 64, QImage::Format_RGB32);
image.fill(Qt::red);
{
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,
QFile::rename(imagePath,
QStringLiteral("path/other_image.jpeg"));
//! [0]
return 0;
}
} // wrapper

View File

@ -0,0 +1,7 @@
TEMPLATE = lib
TARGET = qimagewriter_snippets
QT += core gui widgets
SOURCES = \
main.cpp

View File

@ -16,6 +16,7 @@ contains(QT_BUILD_PARTS, tests) {
polygon \
qfileopenevent \
qfontdatabase \
qimagewriter \
textblock-formats \
textblock-fragments \
textdocument-blocks \