Flipable QML Type
反転可能な表面を提供します。詳細...
Import Statement: | import QtQuick |
Inherits: |
プロパティ
詳細説明
Flipable は、カードのように表と裏を「反転」させることができるアイテムです。Rotation 、State 、Transition の各タイプと併用することで、反転効果を演出することができます。
front およびback プロパティは、Flipable アイテムの表と裏にそれぞれ表示されるアイテムを保持するために使用されます。
使用例
次の例では、クリックされるたびに y 軸を中心に回転しながら反転する Flipable アイテムを示します。
この Flipable アイテムにはflipped
ブーリアン プロパティがあり、Flipable 内のMouseArea がクリックされるたびにトグルされます。flipped
が true の場合、アイテムは "back" 状態に変わります。この状態では、Rotation アイテムのangle
が 180 度に変更され、反転効果が得られます。flipped
が false の場合、アイテムはデフォルトの状態に戻り、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 Componentsも参照してください :Flipable の例も参照してください。
プロパティのドキュメント
side : enumeration |
現在表示されている Flipable の側面。指定可能な値はFlipable.Front
とFlipable.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.