本页内容

CanvasGradient QML Type

提供了一个不透明的 CanvasGradient 接口。更多内容...

Import Statement: import QtQuick

方法

详细说明

方法文档

CanvasGradient addColorStop(real offset, string color)

在指定位置offset 向渐变中添加一个具有指定色值color 的色阶。0.0 表示渐变一端的偏移量,1.0 表示另一端的偏移量。

例如:

var gradient = ctx.createLinearGradient(0, 0, 100, 100);
gradient.addColorStop(0.3, Qt.rgba(1, 0, 0, 1));
gradient.addColorStop(0.7, 'rgba(0, 255, 255, 1)');

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