Skip to content

Commit

Permalink
Doc: compile qimagewriter snippet
Browse files Browse the repository at this point in the history
Done-with: Nico Vertriest <[email protected]>
Task-number: QTBUG-81486
Change-Id: Ibb4087d7035c3061b2980b317ab4280fa38aab50
Reviewed-by: Topi Reiniö <[email protected]>
  • Loading branch information
paulwicking committed Sep 1, 2020
1 parent 45211e9 commit 5ee39fc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/gui/doc/snippets/qimagewriter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
{
QImageWriter writer(imagePath);
writer.write(image);
}
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"));
QFile::rename(imagePath,
QStringLiteral("path/other_image.jpeg"));
//! [0]

return 0;
}
} // wrapper
7 changes: 7 additions & 0 deletions src/gui/doc/snippets/qimagewriter/qimagewriter.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TEMPLATE = lib
TARGET = qimagewriter_snippets
QT += core gui widgets

SOURCES = \
main.cpp

1 change: 1 addition & 0 deletions src/gui/doc/snippets/snippets.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contains(QT_BUILD_PARTS, tests) {
polygon \
qfileopenevent \
qfontdatabase \
qimagewriter \
textblock-formats \
textblock-fragments \
textdocument-blocks \
Expand Down

0 comments on commit 5ee39fc

Please sign in to comment.