PathRectangle QML Type
角が丸い矩形を定義します。詳細...
Import Statement: | import QtQuick |
Since: | QtQuick 6.8 |
プロパティ
- bevel : bool
(since 6.10)
- bottomLeftBevel : bool
- bottomLeftRadius : real
- bottomRightBevel : bool
- bottomRightRadius : real
- height : real
- radius : real
- relativeX : real
- relativeY : real
- strokeAdjustment : real
- topLeftBevel : bool
- topLeftRadius : real
- topRightBevel : bool
- topRightRadius : real
- width : real
- x : real
- y : real
詳細説明
PathRectangle は、長方形を指定する簡単な方法を提供します。API はRectangle の項目に対応しています。
Shape { id: rectangleShape width: 200 height: 150 anchors.centerIn: parent preferredRendererType: Shape.CurveRenderer ShapePath { fillColor: "#3ad23c" PathRectangle { width: rectangleShape.width height: rectangleShape.height topLeftRadius: 30 bottomRightRadius: 30 bevel: true } } }
Path,PathLine,PathQuad,PathCubic,PathArc,PathAngleArc,PathCurve,PathSvgも参照して ください。
プロパティ文書
設定されている場合、これらのプロパティは個々のコーナー半径を定義します。値がゼロの場合、そのコーナーは鋭角であると定義され、正の値の場合、そのコーナーは丸みを帯びていると定義されます。設定されていない場合、radius の値が代わりに使用されます。
これらのプロパティはデフォルトでは設定されていません。未設定の状態に戻すには、undefined
を割り当てます。
以下の例では、radius を10
に、topLeftRadius
を0
に設定しています:
Shape { id: rectangleShape width: 200 height: 150 anchors.centerIn: parent preferredRendererType: Shape.CurveRenderer ShapePath { strokeColor: "black" strokeWidth: 4 joinStyle: ShapePath.MiterJoin PathRectangle { width: rectangleShape.width height: rectangleShape.height radius: 10 topLeftRadius: 0 bottomRightBevel: true } } }
radiusも参照してください 。
設定されている場合、これらのプロパティは個々のコーナー・ベベルを定義する。これらをfalse
に設定すると、個々のradius プロパティの値に応じて、角が鋭くなるか丸くなります。これらをtrue
に設定すると、角が面取りされます。未設定の場合、bevel の値が代わりに使用されます。
これらのプロパティはデフォルトでは設定されていません。未設定の状態に戻すには、undefined
を割り当てます。
以下の例では、bottomRightBevel
を true に設定しています:
Shape { id: rectangleShape width: 200 height: 150 anchors.centerIn: parent preferredRendererType: Shape.CurveRenderer ShapePath { strokeColor: "black" strokeWidth: 4 joinStyle: ShapePath.MiterJoin PathRectangle { width: rectangleShape.width height: rectangleShape.height radius: 10 topLeftRadius: 0 bottomRightBevel: true } } }
bevelも参照 。
bevel : bool |
このプロパティは、矩形の角を面取りするかどうかを定義します。
このプロパティをfalse
に設定すると、個々のradius プロパティの値によって、角が鋭くなるか丸くなるかが決まります。
このプロパティは、個々のベベル・プロパティによってオーバーライドすることができます。
Shape { id: rectangleShape width: 200 height: 150 anchors.centerIn: parent preferredRendererType: Shape.CurveRenderer ShapePath { fillColor: "#3ad23c" PathRectangle { width: rectangleShape.width height: rectangleShape.height topLeftRadius: 30 bottomRightRadius: 30 bevel: true } } }
このプロパティは Qt 6.10 で導入されました。
topLeftBevel,topRightBevel,bottomLeftBevel,bottomRightBevelも参照してください 。
radius : real |
このプロパティは、丸みを帯びた長方形を定義するために使用される角の半径を定義します。
半径が正の値の場合、矩形パスは丸みを帯びた矩形として定義され、そうでない場合は通常の矩形として定義されます。
こ のプ ロパテ ィ は、 個々の隅の半径プ ロパテ ィ に よ っ て上書きす る こ と も で き ます。
デフ ォル ト 値は0
です。
topLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadiusも参照 。
strokeAdjustment : real |
こ のプ ロパテ ィ は、 矩形座標に対する 描線幅調整を定義 し ます。
スト ロ ー ク を有効に し てShapePath で用い る と 、 実際のス ト ロ ー ク 矩形はデフ ォ ル ト では、 定義 さ れた矩形を超え て、 全辺に対 し て ス ト ロー ク 幅の半分だけ広が り ます。パスが描線の中点線を定義し、QPainter と SVG レンダリングに対応しているので、これは期待される動作です。
その代わりに、Rectangle のボーダー付きアイテムのように、定義された矩形をストロークされた矩形の外縁にしたい場合、strokeAdjustment をストローク幅に設定することができます。これにより、すべてのエッジがストローク幅の半分だけ内側に移動します。次の例のように:
ShapePath { id: myRec fillColor: "white" strokeColor: "black" strokeWidth: 16 joinStyle: ShapePath.MiterJoin PathRectangle { x: 10; y: 10; width: 200; height: 100; strokeAdjustment: myRec.strokeWidth } }
© 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.