From d46eed31a001fed81c0e0d49ee37e0260a1287aa Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 31 Aug 2020 14:19:30 +0200 Subject: [PATCH] Doc: compile picture snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done-with: Nico Vertriest Task-number: QTBUG-81486 Change-Id: I9daf8ed8c7d9620cd59feb40677795cbac30c97c Reviewed-by: Topi Reiniƶ --- src/gui/doc/snippets/picture/picture.cpp | 48 ++++++++++++------------ src/gui/doc/snippets/picture/picture.pro | 7 ++++ src/gui/doc/snippets/snippets.pro | 1 + 3 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 src/gui/doc/snippets/picture/picture.pro diff --git a/src/gui/doc/snippets/picture/picture.cpp b/src/gui/doc/snippets/picture/picture.cpp index 807c263b199..cdf0dda84ba 100644 --- a/src/gui/doc/snippets/picture/picture.cpp +++ b/src/gui/doc/snippets/picture/picture.cpp @@ -47,36 +47,34 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include -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 diff --git a/src/gui/doc/snippets/picture/picture.pro b/src/gui/doc/snippets/picture/picture.pro new file mode 100644 index 00000000000..8a3f6145461 --- /dev/null +++ b/src/gui/doc/snippets/picture/picture.pro @@ -0,0 +1,7 @@ +TEMPLATE = lib +TARGET = picture_snippets +QT += core gui widgets + +SOURCES = \ + picture.cpp + diff --git a/src/gui/doc/snippets/snippets.pro b/src/gui/doc/snippets/snippets.pro index 088a4007514..eb2141895ce 100644 --- a/src/gui/doc/snippets/snippets.pro +++ b/src/gui/doc/snippets/snippets.pro @@ -11,6 +11,7 @@ contains(QT_BUILD_PARTS, tests) { dropevents \ droprectangle \ image \ + picture \ qfontdatabase \ textblock-formats \ textblock-fragments \