Skip to content

Commit

Permalink
Doc: compile picture snippets
Browse files Browse the repository at this point in the history
Done-with: Nico Vertriest <[email protected]>
Task-number: QTBUG-81486
Change-Id: I9daf8ed8c7d9620cd59feb40677795cbac30c97c
Reviewed-by: Topi Reiniö <[email protected]>
  • Loading branch information
paulwicking committed Sep 1, 2020
1 parent 91ab585 commit d46eed3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
48 changes: 23 additions & 25 deletions src/gui/doc/snippets/picture/picture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,34 @@
** $QT_END_LICENSE$
**
****************************************************************************/

#include <QtWidgets>

void myProcessing(const QString &)
{
}

int main()
namespace picture {
void wrapper0()
{
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
7 changes: 7 additions & 0 deletions src/gui/doc/snippets/picture/picture.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TEMPLATE = lib
TARGET = picture_snippets
QT += core gui widgets

SOURCES = \
picture.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 @@ -11,6 +11,7 @@ contains(QT_BUILD_PARTS, tests) {
dropevents \
droprectangle \
image \
picture \
qfontdatabase \
textblock-formats \
textblock-fragments \
Expand Down

0 comments on commit d46eed3

Please sign in to comment.