summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-08-26 14:15:26 +0200
committerPaul Wicking <paul.wicking@qt.io>2020-08-28 12:32:22 +0200
commit4853cff109d51661b088269c4be3210846f396e4 (patch)
tree8c6562a66d68fe8e2eb7c3fe232cfbf5d6ae1d9e /src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
parent176e7d4d8c634972c201b2d01a87536e182c1793 (diff)
Doc: Compile painting snippets
Fix minor issues (e.g. whitespace, missing semi-colon) in passing. Change-Id: I223cb257539d2ac4cb0a1ea209f0c3cebddb3d54 Done-with: Nico Vertriest <nico.vertriest@qt.io> Task-number: QTBUG-81486 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp')
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp62
1 files changed, 58 insertions, 4 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
index e6d72fce12..f11b6f59c5 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainterpath.cpp
@@ -47,6 +47,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QLinearGradient>
+#include <QPainter>
+#include <QPainterPath>
+#include <QPen>
+
+namespace src_gui_painting_qpainterpath {
+struct Wrapper : QPaintDevice
+{
+ Q_OBJECT
+
+ void wrapper0();
+ void wrapper1();
+ void wrapper2();
+ void wrapper3();
+ void wrapper4();
+ void wrapper5();
+ void wrapper6();
+ void wrapper7();
+};
+
+void Wrapper::wrapper0() {
//! [0]
QPainterPath path;
@@ -65,6 +86,13 @@ painter.setBrush(QColor(122, 163, 39));
painter.drawPath(path);
//! [0]
+} // Wrapper::wrapper0
+
+
+void Wrapper::wrapper1() {
+const QPointF c1;
+const QPointF c2;
+const QPointF endPoint;
//! [1]
QLinearGradient myGradient;
@@ -79,13 +107,17 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [1]
+} // Wrapper::wrapper1
-//! [2]
+
+void Wrapper::wrapper2() {
+const QRectF boundingRect;
+qreal startAngle = 0;
+qreal sweepLength = 0;
+QPointF center;
QLinearGradient myGradient;
QPen myPen;
-
-QPointF center, startPoint;
-
+//! [2]
QPainterPath myPath;
myPath.moveTo(center);
myPath.arcTo(boundingRect, startAngle,
@@ -97,6 +129,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [2]
+} // Wrapper::wrapper2
+
+
+void Wrapper::wrapper3() {
//! [3]
QLinearGradient myGradient;
@@ -112,6 +148,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [3]
+} // Wrapper::wrapper3
+
+
+void Wrapper::wrapper4() {
//! [4]
QLinearGradient myGradient;
@@ -127,6 +167,10 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [4]
+} // Wrapper::wrapper4
+
+
+void Wrapper::wrapper5() {
//! [5]
QLinearGradient myGradient;
@@ -142,6 +186,12 @@ painter.setPen(myPen);
painter.drawPath(myPath);
//! [5]
+} // Wrapper::wrapper5
+
+
+void Wrapper::wrapper6() {
+qreal x = 0;
+qreal y = 0;
//! [6]
QLinearGradient myGradient;
@@ -157,3 +207,7 @@ painter.setBrush(myGradient);
painter.setPen(myPen);
painter.drawPath(myPath);
//! [6]
+
+
+} // Wrapper::wrapper6
+} // src_gui_painting_qpainterpath