Fix dynamicscene example to use a QML module

Pick-to: 6.2
Change-Id: I23b87b8ca98721cebc0dc948f0c9bbf741af6cd5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Ulf Hermann 2021-08-31 16:46:32 +02:00
parent a57d3a0beb
commit be260ba529
17 changed files with 47 additions and 66 deletions

View File

@ -1,13 +1,8 @@
# Generated from dynamicscene.pro.
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.16)
project(dynamicscene LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
@ -15,52 +10,39 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/dynamicscene")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Quick)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Core Gui Quick Qml)
qt_add_executable(dynamicscene
main.cpp
)
set_target_properties(dynamicscene PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(dynamicscene PUBLIC
qt_add_executable(dynamicsceneexample WIN32 MACOSX_BUNDLE main.cpp)
target_link_libraries(dynamicsceneexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
# Resources:
set(dynamicscene_resource_files
"content/GenericSceneItem.qml"
"content/PaletteItem.qml"
"content/PerspectiveItem.qml"
"content/Sun.qml"
"content/images/NOTE"
"content/images/face-smile.png"
"content/images/moon.png"
"content/images/rabbit_brown.png"
"content/images/rabbit_bw.png"
"content/images/star.png"
"content/images/sun.png"
"content/images/tree_s.png"
"content/itemCreation.js"
"dynamicscene.qml"
qt_add_qml_module(dynamicsceneexample
URI dynamicscene
VERSION 1.0
QML_FILES
"GenericSceneItem.qml"
"PaletteItem.qml"
"PerspectiveItem.qml"
"Sun.qml"
"dynamicscene.qml"
"itemCreation.js"
RESOURCES
"images/NOTE"
"images/face-smile.png"
"images/moon.png"
"images/rabbit_brown.png"
"images/rabbit_bw.png"
"images/star.png"
"images/sun.png"
"images/tree_s.png"
)
qt6_add_resources(dynamicscene "dynamicscene"
PREFIX
"/"
FILES
${dynamicscene_resource_files}
)
install(TARGETS dynamicscene
install(TARGETS dynamicsceneexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -51,7 +51,6 @@
import QtQuick
import QtQuick.Particles
import QtQuick.Controls
import "content"
Item {
id: window
@ -120,7 +119,7 @@ Item {
ImageParticle {
id: stars
source: "content/images/star.png"
source: "images/star.png"
groups: ["stars"]
opacity: .5
}
@ -171,31 +170,31 @@ Item {
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "Sun.qml"
source: "content/images/sun.png"
source: "images/sun.png"
image: "images/sun.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "GenericSceneItem.qml"
source: "content/images/moon.png"
source: "images/moon.png"
image: "images/moon.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
source: "content/images/tree_s.png"
source: "images/tree_s.png"
image: "images/tree_s.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
source: "content/images/rabbit_brown.png"
source: "images/rabbit_brown.png"
image: "images/rabbit_brown.png"
}
PaletteItem {
anchors.verticalCenter: parent.verticalCenter
componentFile: "PerspectiveItem.qml"
source: "content/images/rabbit_bw.png"
source: "images/rabbit_bw.png"
image: "images/rabbit_bw.png"
}
}
@ -258,7 +257,7 @@ Item {
selectByMouse: true
wrapMode: TextEdit.WordWrap
text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 40 * Math.random() \n source: 'content/images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}"
text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 40 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}"
}
}
}

View File

@ -1,18 +1,18 @@
<RCC>
<qresource prefix="/">
<qresource prefix="/dynamicscene">
<file>dynamicscene.qml</file>
<file>content/images/face-smile.png</file>
<file>content/images/moon.png</file>
<file>content/images/NOTE</file>
<file>content/images/rabbit_brown.png</file>
<file>content/images/rabbit_bw.png</file>
<file>content/images/star.png</file>
<file>content/images/sun.png</file>
<file>content/images/tree_s.png</file>
<file>content/GenericSceneItem.qml</file>
<file>content/itemCreation.js</file>
<file>content/PaletteItem.qml</file>
<file>content/PerspectiveItem.qml</file>
<file>content/Sun.qml</file>
<file>images/face-smile.png</file>
<file>images/moon.png</file>
<file>images/NOTE</file>
<file>images/rabbit_brown.png</file>
<file>images/rabbit_bw.png</file>
<file>images/star.png</file>
<file>images/sun.png</file>
<file>images/tree_s.png</file>
<file>GenericSceneItem.qml</file>
<file>itemCreation.js</file>
<file>PaletteItem.qml</file>
<file>PerspectiveItem.qml</file>
<file>Sun.qml</file>
</qresource>
</RCC>

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../quick/shared/shared.h"
DECLARATIVE_EXAMPLE_MAIN(dynamicscene)
DECLARATIVE_EXAMPLE_MAIN(dynamicscene/dynamicscene)