Shear QML Type
提供一种剪切项的方法。更多
Import Statement: | import QtQuick |
Since: | Qt 6.9 |
属性
详细说明
剪切类型提供了一种通过二维剪切矩阵(有时也称为倾斜变换)对Item 进行变换的方法。
Rectangle { width: 100; height: 100 color: "blue" transform: Shear { xFactor: 1.0 } }
该矩阵沿 x 轴以1.0
的系数对项目进行剪切,而不修改沿 y 轴的任何内容。每个点P
的位移为xFactor(P.y - origin.y)
(到origin 的带符号垂直距离乘以xFactor )。设置yFactor 会沿 y 轴剪切项目,并与水平距离成比例。
由于默认的原点位于(0, 0)
,因此项目的顶部保持不变,而底部则向右移动了 100 个像素(与项目的高度相对应)。
这段代码相当于下面的代码:
Rectangle { width: 100; height: 100 color: "blue" transform: Shear { xAngle: 45.0 } }
注: 如果同时设置了xFactor
/yFactor
和xAngle
/yAngle
,则将使用两个位移的总和。
属性文档
xFactor : real |
项目坐标系沿 x 轴剪切的因子。每个点P
的位移系数为xFactor(P.y - origin.y)
这相当于QTransform::shear() 中的sh
参数和调用PlanarTransform::fromShear() 时的xShear
参数。
默认值为0.0
。
另请参见 xAngle 。
yFactor : real |
项目坐标系沿 Y 轴剪切的因子。项目坐标系沿 x 轴剪切的因子。每个点P
的位移为xFactor(P.y - origin.y)
这相当于QTransform::shear() 中的sv
参数和调用PlanarTransform::fromShear() 时的yShear
参数。
默认值为0.0
。
另请参见 yAngle 。
© 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.