Obsolete Members for Canvas | Qt Quick 5.12.5

Qt 5.12 | Qt Quick | QML Types | Obsolete Members for Canvas

Qt 5.12.5 Reference Documentation

# Obsolete Members for Canvas

The following members of QML type Canvas are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Properties

- available : bool
- canvasSize : size
- context : object
- contextType : string
- renderStrategy : enumeration
- renderTarget : enumeration

## Property Documentation

available : bool

Indicates when Canvas is able to provide a drawing context to operate on.

canvasSize : size

Holds the logical canvas size that the context paints on.

By default, the canvas size is the same size as the current canvas item size.

By setting the canvasSize, tileSize and canvasWindow, the Canvas item can act as a large virtual canvas with many separately rendered tile rectangles. Only those tiles within the current canvas window are painted by the Canvas render engine.

See also tileSize and canvasWindow.

context : object

Holds the active drawing context.

If the canvas is ready and there has been a successful call to getContext() or the contextType property has been set with a supported context type, this property will contain the current drawing context, otherwise null.

contextType : string

The type of drawing context to use.

This property is set to the name of the active context type.

If set explicitly the canvas will attempt to create a context of the named type after becoming available.

The type name is the same as used in the getContext() call, for the 2d canvas the value will be "2d".

See also getContext() and available.

renderStrategy : enumeration

Holds the current canvas rendering strategy.

- Canvas.Immediate - context will perform graphics commands immediately in the main UI thread.
- Canvas.Threaded - context will defer graphics commands to a private rendering thread.
- Canvas.Cooperative - context will defer graphics commands to the applications global render thread.

This hint is supplied along with renderTarget to the graphics context to determine the method of rendering. A renderStrategy, 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.

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.

renderTarget : enumeration

Holds the current canvas render target.

- Canvas.Image - render to an in memory image buffer.
- Canvas.FramebufferObject - render to an OpenGL frame buffer

This hint is supplied along with renderStrategy to the graphics context to determine the method of rendering. A renderStrategy, 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`.