ParentChange QML Type
상태 변경 시 아이템의 부모를 다시 지정하는 방법을 지정합니다. 자세히...
Import Statement: | import QtQuick |
속성
- height : real
- parent : Item
- rotation : real
- scale : real
- target : Item
- width : real
- x : real
- y : real
상세 설명
부모 변경은 화면에서 항목의 시각적 모양(위치, 크기, 회전, 배율)을 유지하면서 항목의 부모를 다시 지정합니다. 그런 다음 전환을 지정하여 항목을 최종 의도한 모양으로 이동/크기 조정/회전/배율을 조정할 수 있습니다.
부모 변경은 복잡한 변환이 포함되지 않은 경우에만 시각적 모양을 유지할 수 있습니다. 보다 구체적으로, 부모 변경에 관련된 항목(즉, 원래 부모와 새 부모의 공통 조상 트리에 있는 항목)에 대해 변형 속성이 설정되어 있는 경우에는 작동하지 않습니다.
아래 예에서는 큰 빨간색 직사각형과 작은 파란색 직사각형을 나란히 표시합니다. blueRect
을 클릭하면 부모가 redRect
으로 변경되고 빨간색 사각형 내의 (10, 10)에 위치하는 "부모 변경" 상태로 변경됩니다(부모 변경에 지정된 대로).
import QtQuick Item { width: 200; height: 100 Rectangle { id: redRect width: 100; height: 100 color: "red" } Rectangle { id: blueRect x: redRect.width width: 50; height: 50 color: "blue" states: State { name: "reparented" ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 } } MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" } } }
ParentAnimation 을 사용하여 전환의 어느 지점에서 부모 변경을 수행할지 지정할 수 있습니다.
PropertyChanges 와 달리 ParentChange는 아이템 기반 타깃을 기대하므로 임의의 객체에서는 작동하지 않습니다(예: 타이머를 부모 변경하는 데 사용할 수 없음).
속성 문서
이 속성은 이 상태의 항목에 대한 새 위치, 크기, 배율 및 회전을 보유합니다.
parent : Item |
이 속성은 이 상태의 항목에 대한 새 부모를 보유합니다.
target : Item |
이 속성은 부모를 다시 지정할 항목을 보유합니다.
© 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.