PathRectangle QML Type

角が丸い矩形を定義します。詳細...

Import Statement: import QtQuick
Since: QtQuick 6.8

プロパティ

詳細説明

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も参照して ください。

プロパティ文書

x : real

y : real

矩形の左上の角を定義します。

こ の角が丸 く さ れていない限 り 、 こ れはパ ス の始点 と 終点 と な り ます。

relativeXrelativeYも参照してください


relativeX : real

relativeY : real

パスの開始点に対する相対的な矩形の左上隅を定義する。

相対位置 と 絶対位置の両方の終了位置が 1 つの軸に指定 さ れてい る と き は、 相対位置が用い ら れます。

相対位置 と 絶対位置は混在可能であ り 、 た と えば相対 x と 絶対 y を設定する こ と も 有効です。

x およびyも参照


height : real

width : real

矩形の幅 と 高 さ を定義 し ます。

x およびyも参照してください


bottomLeftRadius : real

bottomRightRadius : real

topLeftRadius : real

topRightRadius : real

設定されている場合、これらのプロパティは個々のコーナー半径を定義します。値がゼロの場合、そのコーナーは鋭角であると定義され、正の値の場合、そのコーナーは丸みを帯びていると定義されます。設定されていない場合、radius の値が代わりに使用されます。

これらのプロパティはデフォルトでは設定されていません。未設定の状態に戻すには、undefined を割り当てます。

以下の例では、radius10 に、topLeftRadius0 に設定しています:

    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も参照してください


bottomLeftBevel : bool

bottomRightBevel : bool

topLeftBevel : bool

topRightBevel : bool

設定されている場合、これらのプロパティは個々のコーナー・ベベルを定義する。これらを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 [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も参照してください


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.