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:
parent
45211e947a
commit
5ee39fc7c9
@ -47,25 +47,20 @@
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
void wrapper() {
|
||||
//! [0]
|
||||
QString imagePath(QStringLiteral("path/image.jpeg"));
|
||||
QImage image(64, 64, QImage::Format_RGB32);
|
||||
image.fill(Qt::red);
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
//! [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]
|
||||
|
||||
return 0;
|
||||
QImageWriter writer(imagePath);
|
||||
writer.write(image);
|
||||
}
|
||||
|
||||
QFile::rename(imagePath,
|
||||
QStringLiteral("path/other_image.jpeg"));
|
||||
//! [0]
|
||||
|
||||
} // wrapper
|
||||
|
7
src/gui/doc/snippets/qimagewriter/qimagewriter.pro
Normal file
7
src/gui/doc/snippets/qimagewriter/qimagewriter.pro
Normal file
@ -0,0 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = qimagewriter_snippets
|
||||
QT += core gui widgets
|
||||
|
||||
SOURCES = \
|
||||
main.cpp
|
||||
|
@ -16,6 +16,7 @@ contains(QT_BUILD_PARTS, tests) {
|
||||
polygon \
|
||||
qfileopenevent \
|
||||
qfontdatabase \
|
||||
qimagewriter \
|
||||
textblock-formats \
|
||||
textblock-fragments \
|
||||
textdocument-blocks \
|
||||
|
Loading…
Reference in New Issue
Block a user