Provides a way to shear an Item. 更多...
| import 语句: |
import QtQuick
|
| Since: | Qt 6.9 |
The Shear type provides a way to transform an Item by a two-dimensional shear-type matrix, sometimes known as a skew transform.
Rectangle { width: 100; height: 100 color: "blue" transform: Shear { xFactor: 1.0 } }
This shears the item by a factor of
1.0
along the x-axis without modifying anything along the y-axis. Each point
P
is displaced by
xFactor(P.y - origin.y)
(the signed vertical distance to the
origin
multiplied with the
xFactor
). Setting the
yFactor
shears the item along the y-axis and proportionally to the horizontal distance.
Since the default origin is at
(0, 0)
, the top of the item remains untransformed, whereas the bottom is displaced 100 pixels to the right (corresponding to the height of the item.)
This code is equivalent to the following:
Rectangle { width: 100; height: 100 color: "blue" transform: Shear { xAngle: 45.0 } }
注意:
If both
xFactor
/
yFactor
and
xAngle
/
yAngle
are set, then the sum of the two displacements will be used.
|
origin group |
|---|
|
origin.x : real |
|
origin.y : real |
The origin point of the transformation (i.e., the point that stays fixed relative to the parent as the rest of the item is sheared).
By default the origin is
(0, 0)
.
|
xAngle : real |
The angle (in degrees) by which to shear the item's coordinate system along the x-axis. This is equivalent to setting
xFactor
to
tan(xAngle)
.
默认值为
0.0
.
另请参阅 xFactor .
|
xFactor : real |
The factor by which to shear the item's coordinate system along the x-axis. Each point
P
is displaced by
xFactor(P.y - origin.y)
This corresponds to the
sh
parameter in
QTransform::shear
() 和
xShear
parameter in calls to
PlanarTransform::fromShear
().
默认值为
0.0
.
另请参阅 xAngle .
|
yAngle : real |
The angle (in degrees) by which to shear the item's coordinate system along the y-axis. This is equivalent to setting
yFactor
to
tan(yAngle)
.
默认值为
0.0
.
另请参阅 yFactor .
|
yFactor : real |
The factor by which to shear the item's coordinate system along the y-axis. The factor by which to shear the item's coordinate system along the x-axis. Each point
P
is displaced by
xFactor(P.y - origin.y)
This corresponds to the
sv
parameter in
QTransform::shear
() 和
yShear
parameter in calls to
PlanarTransform::fromShear
().
默认值为
0.0
.
另请参阅 yAngle .