Flipable QML Type

뒤집을 수 있는 표면을 제공합니다. 더 보기...

Import Statement: import QtQuick
Inherits:

Item

속성

상세 설명

플립은 카드처럼 앞면과 뒷면을 눈에 띄게 "뒤집을" 수 있는 아이템입니다. Rotation , StateTransition 유형과 함께 사용하여 뒤집는 효과를 낼 수 있습니다.

frontback 속성은 플립 가능한 항목의 앞면과 뒷면에 각각 표시되는 항목을 보관하는 데 사용됩니다.

사용 예

다음 예제에서는 클릭할 때마다 뒤집어지는 플립 가능 항목이 y축을 중심으로 회전하는 모습을 보여 줍니다.

이 플립 가능 항목에는 플립 가능 항목 내의 MouseArea 을 클릭할 때마다 토글되는 flipped 부울 속성이 있습니다. flipped 이 참이면 항목이 "뒤로" 상태로 변경되며, 이 상태에서는 Rotation 항목의 angle 이 180도로 변경되어 뒤집기 효과가 발생합니다. flipped 이 거짓이면 항목은 angle 값이 0인 기본 상태로 되돌아갑니다.

import QtQuick

Flipable {
    id: flipable
    width: 240
    height: 240

    property bool flipped: false

    front: Image { source: "front.png"; anchors.centerIn: parent }
    back: Image { source: "back.png"; anchors.centerIn: parent }

    transform: Rotation {
        id: rotation
        origin.x: flipable.width/2
        origin.y: flipable.height/2
        axis.x: 0; axis.y: 1; axis.z: 0     // set axis.y to 1 to rotate around y-axis
        angle: 0    // the default angle
    }

    states: State {
        name: "back"
        PropertyChanges { target: rotation; angle: 180 }
        when: flipable.flipped
    }

    transitions: Transition {
        NumberAnimation { target: rotation; property: "angle"; duration: 4000 }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: flipable.flipped = !flipable.flipped
    }
}

Transition 은 4초에 걸쳐 각도를 변경하는 애니메이션을 생성합니다. 항목이 '뒤로' 상태와 기본 상태 간에 변경되면 NumberAnimation 애니메이션은 이전 값과 새 값 사이의 각도를 변경합니다.

상태 변경 및 기본 상태에 대한 자세한 내용은 Qt Quick 상태를 참조하고, 전환 내에서 애니메이션이 작동하는 방식에 대한 자세한 내용은 Qt Quick 의 애니메이션 및 전환을 참조하세요.

UI 컴포넌트도참조하세요 :플립 가능 예시를 참고하세요.

프로퍼티 문서

back : Item

front : Item

플리퍼블의 앞면과 뒷면입니다.


side : enumeration [read-only]

현재 보이는 플리퍼블의 측면입니다. 가능한 값은 Flipable.FrontFlipable.Back 입니다.


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