TraceCanvas QML Type

A specialized Canvas type for rendering Trace objects. 更多...

import 語句: import QtQuick.VirtualKeyboard.Styles 2.2
Since: QtQuick.VirtualKeyboard 2.0
繼承: Canvas

特性

方法

詳細描述

This type provides capabilities for rendering Trace objects on the screen.

To make the Trace rendering available in the keyboard, this type must be declared as the KeyboardStyle.traceCanvasDelegate 組件。

traceCanvasDelegate: TraceCanvas {
}
					

Custom drawing attributes can be initialized in the Canvas.available signal. For example:

onAvailableChanged: {
    if (!available)
        return;
    var ctx = getContext("2d")
    ctx.lineWidth = 8 * scaleHint
    ctx.lineCap = "round"
    ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF)
    ctx.fillStyle = ctx.strokeStyle
}
					

The type offers built-in options for Trace rendering. Currently the following rendering options are available:

  • renderSmoothedLine Renders smoothed line with round corners (the default)

The rendering function can be changed with the renderFunction 特性。

renderFunction: renderSmoothedLine
					

Custom rendering function is also supported. Consider the following example:

renderFunction: renderCustomLine
function renderCustomLine() {
    getContext("2d")
    var points = trace.points()
    ...
}
					

特性文檔編製

autoDestroy : bool

Enables auto destruction mode.

If enabled, this item will be destroyed when the trace 對象被銷毀。

默認值為 false。

autoDestroyDelay : int

Specifies the approximate delay in milliseconds, counted from the beginning of the auto destruction, before the object is to be destroyed.

This delay makes it possible, for example, to animate the item before destruction.

默認值為 0。

renderFunction : var

This property defines the rendering function.

默認值為 renderSmoothedLine

trace : var

提供訪問 Trace 對象。


方法文檔編製

renderSmoothedLine ()

Renders smoothed line with round corners.

This function is incremental and renders only the new part added to the Trace.

This function does not alter any of the canvas attributes (i.e. they can be set elsewhere.)

版權所有  © 2014-2026 樂數軟件    

工業和信息化部: 粵ICP備14079481號-1