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も参照して ください。
プロパティ文書
bevel : bool [since 6.10]
このプロパティは、矩形の角を面取りするかどうかを定義する。
このプロパティを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も参照してください 。
設定されている場合、これらのプロパティは個々のコーナー・ベベルを定義する。これらを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も参照してください 。
設定されている場合、これらのプロパティは個々のコーナー半径を定義します。値がゼロの場合、そのコーナーは鋭角であると定義され、正の値の場合、そのコーナーは丸みを帯びていると定義されます。設定されていない場合、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も参照してください 。
矩形の幅 と 高 さ を定義 し ます。
radius : real
このプロパティは、丸みを帯びた矩形を定義するために使用される角の半径を定義する。
半径が正の値の場合、矩形パスは丸みを帯びた矩形として定義され、そうでない場合は通常の矩形として定義される。
こ のプ ロパテ ィ は、 個々の隅の半径プ ロパテ ィ に よ っ て上書きす る こ と も で き ます。
デフ ォル ト 値は0 です。
topLeftRadius,topRightRadius,bottomLeftRadius,bottomRightRadiusも参照 。
パスの開始点に対する相対的な矩形の左上隅を定義する。
相対位置 と 絶対位置の両方の終了位置が 1 つの軸に指定 さ れてい る と き は、 相対位置が用い ら れます。
相対位置 と 絶対位置は混在可能であ り 、 た と えば相対 x と 絶対 y を設定する こ と は有効です。
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 } }
矩形の左上の角を定義します。
こ の角が丸 く さ れていない限 り 、 こ れはパ ス の始点 と 終点 と な り ます。
© 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.