本页内容

Qt Canvas2D QML types

该模块处于技术预览阶段,内容可能会有变动。

该模块于 Qt 6.12 中引入。

该 QML 模块包含一个用于Qt Quick 的 `Canvas2D ` 元素。要使用 `Canvas2D`,请使用以下代码行导入该模块:

import QtCanvas2D

Canvas2D QML 类型

Canvas2D

提供一个 2D 画布项,支持通过 JavaScript 进行绘制

Canvas2DContext

提供用于在 Canvas2D 控件上绘图的 2D 绘图上下文

boxgradient2d

提供与 QCanvasBoxGradient 匹配的 boxgradient2d 类型

boxshadow2d

提供与 QCanvasBoxShadow 匹配的 boxshadow2d 类型

conicalgradient2d

提供与 QCanvasConicalGradient 匹配的 conicalgradient2d 类型

gridpattern2d

提供与 QCanvasGridPattern 类型匹配的 gridpattern2d

imagepattern2d

为 QCanvasImagePattern 提供 imagepattern2d 类型匹配

lineargradient2d

为 QCanvasLinearGradient 提供 lineargradient2d 类型匹配

path2d

提供 path2d 类型,即与 QCanvasPath 匹配的绘图路径容器

radialgradient2d

为 QCanvasRadialGradient 提供 radialgradient2d 类型匹配

transform2d

提供与 QTransform 匹配的 transform2d 类型,即一个 3x3 的二维变换矩阵

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