summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc/src
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2024-12-17 11:12:13 +0100
committerFriedemann Kleint <[email protected]>2024-12-17 19:59:01 +0100
commit1dc15c11db88f96a916258acea80a86bfa7c87cd (patch)
treeb9f260b60f259414612c463688f554f330c91f83 /examples/widgets/doc/src
parent5731fe051e48e7a256ef31ae93cfb89ce8d871cc (diff)
Use QPainterStateGuard in examples
Complements 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105. Pick-to: 6.9 Change-Id: I65456f8fd34bf9d316b72c4286e1b15789309f7c Reviewed-by: Christian Ehrlicher <[email protected]>
Diffstat (limited to 'examples/widgets/doc/src')
-rw-r--r--examples/widgets/doc/src/analogclock.qdoc9
-rw-r--r--examples/widgets/doc/src/basicdrawing.qdoc10
-rw-r--r--examples/widgets/doc/src/transformations.qdoc12
3 files changed, 14 insertions, 17 deletions
diff --git a/examples/widgets/doc/src/analogclock.qdoc b/examples/widgets/doc/src/analogclock.qdoc
index 8f98f4b7b08..aeaddd4b936 100644
--- a/examples/widgets/doc/src/analogclock.qdoc
+++ b/examples/widgets/doc/src/analogclock.qdoc
@@ -106,11 +106,10 @@
system counterclockwise by a number of degrees determined by the current
hour and minute. This means that the hand will be shown rotated clockwise
by the required amount.
- We save and restore the transformation matrix before and after the
- rotation because we want to place the minute hand without having to
- take into account any previous rotations.
+ We save and restore the transformation matrix before and after the rotation
+ by instantiating a QPainterStateGuard because we want to place the minute
+ hand without having to take into account any previous rotations.
- \snippet widgets/analogclock/analogclock.cpp 17
\snippet widgets/analogclock/analogclock.cpp 19
We draw markers around the edge of the clock for each hour in the same
@@ -123,7 +122,7 @@
\snippet widgets/analogclock/analogclock.cpp 21
- For the seconds hand we do the same and add two cicles as a visual highlight.
+ For the seconds hand we do the same and add two circles as a visual highlight.
\snippet widgets/analogclock/analogclock.cpp 23
\codeline
diff --git a/examples/widgets/doc/src/basicdrawing.qdoc b/examples/widgets/doc/src/basicdrawing.qdoc
index 0882c0f32f3..a4606a29814 100644
--- a/examples/widgets/doc/src/basicdrawing.qdoc
+++ b/examples/widgets/doc/src/basicdrawing.qdoc
@@ -370,8 +370,8 @@
RenderArea widget, and we calculate their positions using two \c
for loops and the widgets height and width.
- For each copy we first save the current painter state (pushes the
- state onto a stack). Then we translate the coordinate system,
+ For each copy we first save the current painter state by instantiating
+ a QPainterStateGuard. Then we translate the coordinate system,
using the QPainter::translate() function, to the position
determined by the variables of the \c for loops. If we omit this
translation of the coordinate system all the copies of the shape
@@ -420,9 +420,9 @@
\snippet painting/basicdrawing/renderarea.cpp 13
- Then, when we are finished rendering a copy of the shape we can
- restore the original painter state, with its associated coordinate
- system, using the QPainter::restore() function. In this way we
+ Then, when we are finished rendering a copy of the shape,
+ the original painter state is restored by QPainterStateGuard,
+ which calls the QPainter::restore() function. In this way, we
ensure that the next shape copy will be rendered in the correct
position.
diff --git a/examples/widgets/doc/src/transformations.qdoc b/examples/widgets/doc/src/transformations.qdoc
index d90708340c1..f8a29407c83 100644
--- a/examples/widgets/doc/src/transformations.qdoc
+++ b/examples/widgets/doc/src/transformations.qdoc
@@ -161,13 +161,11 @@
\snippet painting/transformations/renderarea.cpp 6
- Before we start to render the shape, we call the QPainter::save()
- function.
-
- QPainter::save() saves the current painter state (i.e. pushes the
- state onto a stack) including the current coordinate system. The
- rationale for saving the painter state is that the following call
- to the \c transformPainter() function will transform the
+ Before we start to render the shape, we instantiate
+ a QPainterStateGuard to save the current painter state (i.e. push the
+ state onto a stack) including the current coordinate system while
+ in scope. The rationale for saving the painter state is that the
+ following call to the \c transformPainter() function will transform the
coordinate system depending on the currently chosen transformation
operations, and we need a way to get back to the original state to
draw the outline.