rect QML Value Type
x, y, width 및 height 속성을 가진 값. 더 보기...
| Import Statement: | import QtQml |
상세 설명
rect 유형은 x, y, width 및 height 속성을 가진 값을 나타냅니다.
rect 유형의 속성은 기본적으로 Qt.rect(0, 0, 0, 0) 입니다. 이는 좌표 원점에 위치한 빈 사각형입니다.
예를 들어, Item 의 childrenRect 직사각형 유형 속성에 대한 width 및 height 값을 읽으려면:
Rectangle {
width: childrenRect.width
height: childrenRect.height
Rectangle { width: 100; height: 100 }
}rect 값을 생성하려면 "x, y, width x height" 형식의 문자열로 지정합니다:
CustomObject { myRectProperty: "50,50,100x100" }또는 Qt.rect() 함수를 사용하십시오:
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }rect 유형은 읽기 전용 left, right, top 및 bottom 속성도 노출합니다. 이들은 C++ counterparts 와 동일합니다.
C++과 통합할 때, C++에서 QML로 전달되는 모든 QRect 또는 QRectF 값은 자동으로 rect 값으로 변환되며, 그 반대의 경우도 마찬가지입니다. rect 값이 C++로 전달되면 자동으로 QRectF 값으로 변환됩니다.
QML 값 유형도 참조하십시오 .
© 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.