Doc: compile picture snippets

Done-with: Nico Vertriest <nico.vertriest@qt.io>
Task-number: QTBUG-81486
Change-Id: I9daf8ed8c7d9620cd59feb40677795cbac30c97c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
bb10
Paul Wicking 2020-08-31 14:19:30 +02:00
parent 91ab585147
commit d46eed31a0
3 changed files with 31 additions and 25 deletions

View File

@ -47,36 +47,34 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtWidgets>
void myProcessing(const QString &)
namespace picture {
void wrapper0()
{
}
int main()
{
QWidget myWidget;
{
// RECORD
//! [0]
QPicture picture;
QPainter painter;
painter.begin(&picture); // paint in picture
painter.drawEllipse(10,20, 80,70); // draw an ellipse
painter.end(); // painting done
picture.save("drawing.pic"); // save picture
QPicture picture;
QPainter painter;
painter.begin(&picture); // paint in picture
painter.drawEllipse(10,20, 80,70); // draw an ellipse
painter.end(); // painting done
picture.save("drawing.pic"); // save picture
//! [0]
}
{
// REPLAY
} // wrapper0
void wrapper1() {
QImage myImage;
//! [1]
QPicture picture;
picture.load("drawing.pic"); // load picture
QPainter painter;
painter.begin(&myImage); // paint in myImage
painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
painter.end(); // painting done
QPicture picture;
picture.load("drawing.pic"); // load picture
QPainter painter;
painter.begin(&myImage); // paint in myImage
painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
painter.end(); // painting done
//! [1]
}
} // wrapper1
} // picture

View File

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

View File

@ -11,6 +11,7 @@ contains(QT_BUILD_PARTS, tests) {
dropevents \
droprectangle \
image \
picture \
qfontdatabase \
textblock-formats \
textblock-fragments \