TraceCanvas QML Type

트레이스 오브젝트 렌더링을 위한 특수 캔버스 유형입니다. 더 보기...

Import Statement: import QtQuick.VirtualKeyboard.Styles
Since: QtQuick.VirtualKeyboard 2.0
Inherits:

Canvas

속성

신호

  • onRecycle(var traceCanvas) (since QtQuick.VirtualKeyboard.Styles 6.1)

방법

상세 설명

이 유형은 화면에 트레이스 객체를 렌더링하는 기능을 제공합니다.

키보드에서 트레이스 렌더링을 사용할 수 있게 하려면 이 유형을 KeyboardStyle.traceCanvasDelegate 컴포넌트로 선언해야 합니다.

traceCanvasDelegate: TraceCanvas {
}

사용자 지정 드로잉 속성은 Canvas.available 신호에서 초기화할 수 있습니다. 예를 들어

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
}

이 유형은 트레이스 렌더링에 대한 기본 제공 옵션을 제공합니다. 현재 다음과 같은 렌더링 옵션을 사용할 수 있습니다:

  • renderSmoothedLine 둥근 모서리가 있는 부드러운 선 렌더링(기본값)

렌더링 기능은 renderFunction 속성을 사용하여 변경할 수 있습니다.

renderFunction: renderSmoothedLine

사용자 지정 렌더링 기능도 지원됩니다. 다음 예시를 살펴보세요:

renderFunction: renderCustomLine

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

    ...
}

속성 문서

autoDestroy : bool

자동 파기 모드를 활성화합니다.

활성화하면 trace 개체가 소멸될 때 이 항목이 소멸됩니다.

기본값은 false입니다. 이 경우 onRecycle 신호가 트리거된 후 캔버스를 재사용할 수 있습니다.


autoDestroyDelay : int

개체가 소멸되거나 재활용될 때까지 자동 소멸이 시작될 때부터 계산되는 대략적인 지연 시간(밀리초)을 지정합니다.

이 지연을 사용하면 예를 들어 소멸 전에 항목에 애니메이션을 적용할 수 있습니다.

기본값은 0입니다.


renderFunction : var

이 속성은 렌더링 함수를 정의합니다.

기본값은 다음과 같습니다. renderSmoothedLine


trace : Trace

Trace 객체에 대한 액세스를 제공합니다.


신호 문서

[since QtQuick.VirtualKeyboard.Styles 6.1] onRecycle(var traceCanvas)

traceCanvas 이 재활용될 때 방출됩니다.

참고: 해당 핸들러는 onOnRecycle 입니다.

이 신호는 QtQuick.VirtualKeyboard.Styles 6.1에 도입되었습니다.


메서드 문서

[since QtQuick.VirtualKeyboard.Styles 6.1] recycle()

모든 드로잉을 지우고 변수를 재설정하여 트레이스 캔버스를 재활용합니다.

이 함수는 완료 후(반환 전) onRecycle 신호를 트리거합니다.

재활용에 성공하면 이 함수는 참을 반환합니다.

이 메서드는 QtQuick.VirtualKeyboard.Styles 6.1에 도입되었습니다.


[since QtQuick.VirtualKeyboard.Styles 6.1] renderClear()

화면을 지우고 렌더링을 재설정합니다.

이 메서드는 QtQuick.VirtualKeyboard.Styles 6.1에 도입되었습니다.


renderSmoothedLine()

둥근 모서리가 있는 부드러운 선을 렌더링합니다.

이 함수는 증분식이며 트레이스에 추가된 새 부분만 렌더링합니다.

이 함수는 캔버스 속성을 변경하지 않습니다(즉, 다른 곳에서 설정할 수 있습니다).


© 2025 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.