This hint is supplied along with to the graphics context to determine the method of rendering. A renderStrategy, or a combination may not be supported by a graphics context, in which case the context will choose appropriate options and Canvas will signal the change to the properties.
Configuration or runtime tests may cause the QML Scene Graph to render in the GUI thread. Selecting Canvas.Cooperative, does not guarantee rendering will occur on a thread separate from the GUI thread.
The default value is Canvas.Immediate.
See also .
renderTarget : enumeration
Holds the current canvas render target.
This hint is supplied along with to the graphics context to determine the method of rendering. A , renderTarget or a combination may not be supported by a graphics context, in which case the context will choose appropriate options and Canvas will signal the change to the properties.
The default render target is Canvas.Image.
Signal Documentation
imageLoaded()
This signal is emitted when an image has been loaded.
The corresponding handler is onImageLoaded.
See also .
paint(rect region)
This signal is emitted when the region needs to be rendered. If a context is active it can be referenced from the context property.
This signal can be triggered by markdirty(), or by changing the current canvas window.
The corresponding handler is onPaint.
painted()
This signal is emitted after all context painting commands are executed and the Canvas has been rendered.
The corresponding handler is onPainted.
Method Documentation
cancelRequestAnimationFrame(long handle)
This function will cancel the animation callback referenced by handle.
(string contextId, ... args)
Returns a drawing context, or null if no context is available.
The contextId parameter names the required context. The Canvas item will return a context that implements the required drawing mode. After the first call to getContext, any subsequent call to getContext with the same contextId will return the same context object.
If the context type is not supported or the canvas has previously been requested to provide a different and incompatible context type, null will be returned.
Canvas only supports a 2d context.
isImageError(url image)
Returns true if the image failed to load.
See also .
isImageLoaded(url image)
Returns true if the image is successfully loaded and ready to use.
See also .
isImageLoading(url image)
Returns true if the image is currently loading.
See also .
loadImage(url image)
Loads the given image asynchronously.
When the image is ready, will be emitted. The loaded image can be unloaded by the method.
Note: Only loaded images can be painted on the Canvas item.
See also , , , , and .
markDirty(rect area)
Mark the given area as dirty, so that when this area is visible the canvas renderer will redraw it. This will trigger the paint signal.
See also and .
(callback)
This function schedules callback to be invoked before composing the Qt Quick scene.
requestPaint()
Request the entire visible region be re-drawn.
See also .
(string filename)
Save the current canvas content into an image file filename. The saved image format is automatically decided by the filename's suffix.
Note: calling this method will force painting the whole canvas, not just the current canvas visible window.
See also , , and .
(string mimeType)
Returns a data URL for the image in the canvas.
The default mimeType is "image/png".
See also .
unloadImage(url image)
Unloads the image.
Once an image is unloaded it cannot be painted by the canvas context unless it is loaded again.
See also , , , , and .
2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.