이 페이지에서

PathRectangle QML Type

모서리를 둥글게 처리할 수도 있는 사각형을 정의합니다. 더 보기...

Import Statement: import QtQuick
Since: QtQuick 6.8

속성

상세 설명

PathRectangle은 사각형을 쉽게 지정할 수 있는 방법을 제공하며, 필요에 따라 모서리를 둥글게 하거나 베벨 처리할 수도 있습니다. 이 API는 Rectangle 항목의 API와 동일합니다.

모서리가 둥글게 처리된 직사각형

    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도 참조하십시오 .

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도 참조하십시오 .

bottomLeftRadius : real

bottomRightRadius : real

topLeftRadius : real

topRightRadius : real

이 속성이 설정된 경우, 각 모서리의 반지름을 개별적으로 정의합니다. 값이 0이면 해당 모서리가 날카로운 모서리로, 양수 값이면 둥근 모서리로 정의됩니다. 설정되지 않은 경우, 대신 ` 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도 참조하십시오 .

height : real

width : real

사각형의 너비와 높이를 정의합니다.

x 및 y도 참조하십시오 .

radius : real

이 속성은 둥근 사각형을 정의하는 데 사용되는 모서리 반지름을 지정합니다.

반지름 값이 양수인 경우, 사각형 경로는 둥근 사각형으로 정의되며, 그렇지 않은 경우 일반 사각형으로 정의됩니다.

이 속성은 개별 모서리 반경 속성에 의해 재정의될 수 있습니다.

기본값은 0 입니다.

topLeftRadius, topRightRadius, bottomLeftRadius 및 bottomRightRadius도 참조하십시오 .

relativeX : real

relativeY : real

경로의 시작점을 기준으로 사각형의 왼쪽 상단 모서리를 정의합니다.

단일 축에 대해 상대적 끝 위치와 절대적 끝 위치가 모두 지정된 경우, 상대적 위치가 사용됩니다.

상대적 위치와 절대적 위치를 혼합하여 사용할 수 있습니다. 예를 들어, x축은 상대적 위치로, y축은 절대적 위치로 설정하는 것이 유효합니다.

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 }
}

x : real

y : real

사각형의 왼쪽 상단 모서리를 지정합니다.

해당 모서리가 둥글게 처리되지 않은 경우, 이 지점은 경로의 시작점이자 끝점이 됩니다.

relativeX 및 relativeY도 참조하십시오 .

© 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.