diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-22 15:20:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-22 15:21:06 +0100 |
commit | f286db98ee41a8aa71b9a65a235b6d3e265d79f4 (patch) | |
tree | 16e17d4c52d35f7e55fc2103db5c96850e9bdfff /src/quick/items/context2d/qquickcanvasitem.cpp | |
parent | ce093497f2d4164fa8abc06cf976f9e36798e11e (diff) | |
parent | b60a5dc9405ce89d7a742abc81b906d5c8cf5f7d (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
Diffstat (limited to 'src/quick/items/context2d/qquickcanvasitem.cpp')
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index fcb6c2da8f..68f465cc5a 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -228,6 +228,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: @@ -237,6 +240,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 |