aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcanvasitem.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-01-21 08:08:30 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-01-21 08:08:30 +0000
commit872a05475721ad771bd347d1526035e6e7479d30 (patch)
tree5edd3e40174ef1379057ff9b1d2107e67e09bda1 /src/quick/items/context2d/qquickcanvasitem.cpp
parentd68a7e04f2a0c01e087190a6171e7c37ffb0359d (diff)
parent81b3d791b5920832eefb616720bccf5cd386cd57 (diff)
Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6
Diffstat (limited to 'src/quick/items/context2d/qquickcanvasitem.cpp')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 9abca59b1c..9fb49f9c9e 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -222,6 +222,9 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
operations. The Canvas output may be saved as an image file or serialized
to a URL.
+ Rendering to the Canvas is done using a Context2D object, usually as a
+ result of the \l paint signal.
+
To define a drawing area in the Canvas item set the \c width and \c height
properties. For example, the following code creates a Canvas item which
has a drawing area with a height of 100 pixels and width of 200 pixels:
@@ -231,6 +234,11 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
id: mycanvas
width: 100
height: 200
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.fillStyle = Qt.rgba(1, 0, 0, 1);
+ ctx.fillRect(0, 0, width, height);
+ }
}
\endqml