aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/customitems/flipable
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/customitems/flipable')
-rw-r--r--examples/quick/customitems/flipable/5_heart.png (renamed from examples/quick/customitems/flipable/content/5_heart.png)bin3872 -> 3872 bytes
-rw-r--r--examples/quick/customitems/flipable/9_club.png (renamed from examples/quick/customitems/flipable/content/9_club.png)bin6135 -> 6135 bytes
-rw-r--r--examples/quick/customitems/flipable/CMakeLists.txt51
-rw-r--r--examples/quick/customitems/flipable/Card.qml43
-rw-r--r--examples/quick/customitems/flipable/back.png (renamed from examples/quick/customitems/flipable/content/back.png)bin1418 -> 1418 bytes
-rw-r--r--examples/quick/customitems/flipable/content/Card.qml90
-rw-r--r--examples/quick/customitems/flipable/doc/src/flipable.qdoc29
-rw-r--r--examples/quick/customitems/flipable/flipable.qml58
-rw-r--r--examples/quick/customitems/flipable/flipable.qrc10
-rw-r--r--examples/quick/customitems/flipable/main.cpp53
10 files changed, 110 insertions, 224 deletions
diff --git a/examples/quick/customitems/flipable/content/5_heart.png b/examples/quick/customitems/flipable/5_heart.png
index fb59d81453..fb59d81453 100644
--- a/examples/quick/customitems/flipable/content/5_heart.png
+++ b/examples/quick/customitems/flipable/5_heart.png
Binary files differ
diff --git a/examples/quick/customitems/flipable/content/9_club.png b/examples/quick/customitems/flipable/9_club.png
index 2545001904..2545001904 100644
--- a/examples/quick/customitems/flipable/content/9_club.png
+++ b/examples/quick/customitems/flipable/9_club.png
Binary files differ
diff --git a/examples/quick/customitems/flipable/CMakeLists.txt b/examples/quick/customitems/flipable/CMakeLists.txt
new file mode 100644
index 0000000000..8d1c7ab7cf
--- /dev/null
+++ b/examples/quick/customitems/flipable/CMakeLists.txt
@@ -0,0 +1,51 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+
+project(flipable LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
+
+qt_standard_project_setup(REQUIRES 6.5)
+
+qt_add_executable(flipableexample
+ WIN32
+ MACOSX_BUNDLE
+ main.cpp
+)
+
+target_link_libraries(flipableexample PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Qml
+ Qt6::Quick
+)
+
+qt_add_qml_module(flipableexample
+ URI flipable
+ QML_FILES
+ "flipable.qml"
+ "Card.qml"
+ RESOURCES
+ "5_heart.png"
+ "9_club.png"
+ "back.png"
+)
+
+install(TARGETS flipableexample
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET flipableexample
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
+)
+install(SCRIPT ${deploy_script})
diff --git a/examples/quick/customitems/flipable/Card.qml b/examples/quick/customitems/flipable/Card.qml
new file mode 100644
index 0000000000..0a1e4059f7
--- /dev/null
+++ b/examples/quick/customitems/flipable/Card.qml
@@ -0,0 +1,43 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+
+Flipable {
+ id: container
+
+ property alias source: frontImage.source
+ property bool flipped: true
+ property int xAxis: 0
+ property int yAxis: 0
+ property int angle: 0
+
+ width: front.width; height: front.height
+
+ front: Image { id: frontImage }
+ back: Image { source: "back.png" }
+
+ state: "back"
+
+ MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped }
+
+ transform: Rotation {
+ id: rotation; origin.x: container.width / 2; origin.y: container.height / 2
+ axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0
+ }
+
+ states: State {
+ name: "back"; when: container.flipped
+ PropertyChanges { rotation.angle: container.angle }
+ }
+
+ transitions: Transition {
+ ParallelAnimation {
+ NumberAnimation { target: rotation; properties: "angle"; duration: 600 }
+ SequentialAnimation {
+ NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 }
+ NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 }
+ }
+ }
+ }
+}
diff --git a/examples/quick/customitems/flipable/content/back.png b/examples/quick/customitems/flipable/back.png
index f715d7487e..f715d7487e 100644
--- a/examples/quick/customitems/flipable/content/back.png
+++ b/examples/quick/customitems/flipable/back.png
Binary files differ
diff --git a/examples/quick/customitems/flipable/content/Card.qml b/examples/quick/customitems/flipable/content/Card.qml
deleted file mode 100644
index ffffdb6b7d..0000000000
--- a/examples/quick/customitems/flipable/content/Card.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flipable {
- id: container
-
- property alias source: frontImage.source
- property bool flipped: true
- property int xAxis: 0
- property int yAxis: 0
- property int angle: 0
-
- width: front.width; height: front.height
-
- front: Image { id: frontImage }
- back: Image { source: "back.png" }
-
- state: "back"
-
- MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped }
-
- transform: Rotation {
- id: rotation; origin.x: container.width / 2; origin.y: container.height / 2
- axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0
- }
-
- states: State {
- name: "back"; when: container.flipped
- PropertyChanges { target: rotation; angle: container.angle }
- }
-
- transitions: Transition {
- ParallelAnimation {
- NumberAnimation { target: rotation; properties: "angle"; duration: 600 }
- SequentialAnimation {
- NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 }
- NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 }
- }
- }
- }
-}
diff --git a/examples/quick/customitems/flipable/doc/src/flipable.qdoc b/examples/quick/customitems/flipable/doc/src/flipable.qdoc
index 58f5492251..8b2eea6611 100644
--- a/examples/quick/customitems/flipable/doc/src/flipable.qdoc
+++ b/examples/quick/customitems/flipable/doc/src/flipable.qdoc
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\title UI Components: Flipable Example
\example customitems/flipable
\brief The Flipable Example shows an item that flips whenever clicked, rotating around the y-axis.
+ \examplecategory {User Interface Components}
This example shows how to use the \l Flipable element.
diff --git a/examples/quick/customitems/flipable/flipable.qml b/examples/quick/customitems/flipable/flipable.qml
index 3662898864..3d95afe75e 100644
--- a/examples/quick/customitems/flipable/flipable.qml
+++ b/examples/quick/customitems/flipable/flipable.qml
@@ -1,55 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import "content"
+import QtQuick
Rectangle {
id: window
@@ -59,7 +11,7 @@ Rectangle {
Row {
anchors.centerIn: parent; spacing: 30
- Card { source: "content/9_club.png"; angle: 180; yAxis: 1 }
- Card { source: "content/5_heart.png"; angle: 540; xAxis: 1 }
+ Card { source: "9_club.png"; angle: 180; yAxis: 1 }
+ Card { source: "5_heart.png"; angle: 540; xAxis: 1 }
}
}
diff --git a/examples/quick/customitems/flipable/flipable.qrc b/examples/quick/customitems/flipable/flipable.qrc
index 7918ccf00e..a8056e45f9 100644
--- a/examples/quick/customitems/flipable/flipable.qrc
+++ b/examples/quick/customitems/flipable/flipable.qrc
@@ -1,9 +1,9 @@
<RCC>
- <qresource prefix="/">
+ <qresource prefix="/qt/qml/flipable">
<file>flipable.qml</file>
- <file>content/5_heart.png</file>
- <file>content/9_club.png</file>
- <file>content/back.png</file>
- <file>content/Card.qml</file>
+ <file>5_heart.png</file>
+ <file>9_club.png</file>
+ <file>back.png</file>
+ <file>Card.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/customitems/flipable/main.cpp b/examples/quick/customitems/flipable/main.cpp
index a0f0d67d45..c94af94422 100644
--- a/examples/quick/customitems/flipable/main.cpp
+++ b/examples/quick/customitems/flipable/main.cpp
@@ -1,51 +1,4 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(flipable)
+DECLARATIVE_EXAMPLE_MAIN(flipable/flipable)