aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/particles/system
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/particles/system')
-rw-r--r--examples/quick/particles/system/CMakeLists.txt121
-rw-r--r--examples/quick/particles/system/doc/src/system.qdoc10
-rw-r--r--examples/quick/particles/system/dynamiccomparison.qml (renamed from examples/quick/particles/system/content/dynamiccomparison.qml)6
-rw-r--r--examples/quick/particles/system/dynamicemitters.qml (renamed from examples/quick/particles/system/content/dynamicemitters.qml)6
-rw-r--r--examples/quick/particles/system/images/particle2.pngbin0 -> 1073 bytes
-rw-r--r--examples/quick/particles/system/images/particle3.pngbin0 -> 574 bytes
-rw-r--r--examples/quick/particles/system/images/sparkleSize.pngbin0 -> 378 bytes
-rw-r--r--examples/quick/particles/system/main.cpp2
-rw-r--r--examples/quick/particles/system/multiplepainters.qml (renamed from examples/quick/particles/system/content/multiplepainters.qml)10
-rw-r--r--examples/quick/particles/system/startstop.qml (renamed from examples/quick/particles/system/content/startstop.qml)8
-rw-r--r--examples/quick/particles/system/system.pro1
-rw-r--r--examples/quick/particles/system/system.qml18
-rw-r--r--examples/quick/particles/system/system.qrc15
-rw-r--r--examples/quick/particles/system/timedgroupchanges.qml (renamed from examples/quick/particles/system/content/timedgroupchanges.qml)6
14 files changed, 67 insertions, 136 deletions
diff --git a/examples/quick/particles/system/CMakeLists.txt b/examples/quick/particles/system/CMakeLists.txt
index 6570678a2b..c8ab118550 100644
--- a/examples/quick/particles/system/CMakeLists.txt
+++ b/examples/quick/particles/system/CMakeLists.txt
@@ -7,7 +7,6 @@ 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,113 +14,43 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/system")
-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(system
+add_subdirectory("../../shared" "shared")
+
+qt_add_executable(systemexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(system PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(system PUBLIC
+target_link_libraries(systemexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(systemexample system_shared)
# Resources:
-set(system_resource_files
- "content/dynamiccomparison.qml"
- "content/dynamicemitters.qml"
- "content/multiplepainters.qml"
- "content/startstop.qml"
- "content/timedgroupchanges.qml"
- "system.qml"
-)
-
-qt6_add_resources(system "system"
- PREFIX
- "/particles/system"
- FILES
- ${system_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
-)
-
-qt6_add_resources(system "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(system "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS system
+qt_add_qml_module(systemexample
+ URI system
+ VERSION 1.0
+ QML_FILES
+ "dynamiccomparison.qml"
+ "dynamicemitters.qml"
+ "multiplepainters.qml"
+ "timedgroupchanges.qml"
+ "startstop.qml"
+ "system.qml"
+ RESOURCES
+ "images/sparkleSize.png"
+ "images/particle2.png"
+ "images/particle3.png"
+)
+
+install(TARGETS systemexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(systemexample)
diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc
index 22382190d3..6b795070fd 100644
--- a/examples/quick/particles/system/doc/src/system.qdoc
+++ b/examples/quick/particles/system/doc/src/system.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image types.
- \snippet particles/system/content/dynamiccomparison.qml fake
+ \snippet particles/system/dynamiccomparison.qml fake
Note how the Image objects are not able to be randomly colorized.
Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was.
@@ -43,14 +43,14 @@
Timed group changes is an example that highlights the ParticleGroup type. While normally referring to groups with a string name is sufficient, additional effects can be
done by setting properties on groups.
The first group has a variable duration on it, but always transitions to the second group.
- \snippet particles/system/content/timedgroupchanges.qml 0
+ \snippet particles/system/timedgroupchanges.qml 0
The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow.
- \snippet particles/system/content/timedgroupchanges.qml 1
+ \snippet particles/system/timedgroupchanges.qml 1
The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle.
- \snippet particles/system/content/timedgroupchanges.qml 2
+ \snippet particles/system/timedgroupchanges.qml 2
If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle
- \snippet particles/system/content/dynamicemitters.qml 0
+ \snippet particles/system/dynamicemitters.qml 0
Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply.
Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for \l {Qt Quick} items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle.
diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/dynamiccomparison.qml
index c1d42863ee..ad529a2041 100644
--- a/examples/quick/particles/system/content/dynamiccomparison.qml
+++ b/examples/quick/particles/system/dynamiccomparison.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/dynamicemitters.qml
index 8eb87d2baa..2b1ca0885e 100644
--- a/examples/quick/particles/system/content/dynamicemitters.qml
+++ b/examples/quick/particles/system/dynamicemitters.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/particles/system/images/particle2.png b/examples/quick/particles/system/images/particle2.png
new file mode 100644
index 0000000000..4f3372cd07
--- /dev/null
+++ b/examples/quick/particles/system/images/particle2.png
Binary files differ
diff --git a/examples/quick/particles/system/images/particle3.png b/examples/quick/particles/system/images/particle3.png
new file mode 100644
index 0000000000..2b04601403
--- /dev/null
+++ b/examples/quick/particles/system/images/particle3.png
Binary files differ
diff --git a/examples/quick/particles/system/images/sparkleSize.png b/examples/quick/particles/system/images/sparkleSize.png
new file mode 100644
index 0000000000..752056541b
--- /dev/null
+++ b/examples/quick/particles/system/images/sparkleSize.png
Binary files differ
diff --git a/examples/quick/particles/system/main.cpp b/examples/quick/particles/system/main.cpp
index 63a88412f5..cc77f3a62d 100644
--- a/examples/quick/particles/system/main.cpp
+++ b/examples/quick/particles/system/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/system/system)
+DECLARATIVE_EXAMPLE_MAIN(system/system)
diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/multiplepainters.qml
index 1f2dcb6214..62ca583e2e 100644
--- a/examples/quick/particles/system/content/multiplepainters.qml
+++ b/examples/quick/particles/system/multiplepainters.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -83,14 +83,14 @@ Rectangle {
ImageParticle {
system: sys
visible: !cloneMode
- source: "../../images/particle2.png"
+ source: "images/particle2.png"
}
ImageParticle {
system: sys
visible: cloneMode
z: 0
- source: "../../images/particle3.png"
+ source: "images/particle3.png"
}
ImageParticle {
diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/startstop.qml
index a9ef7285aa..1eff8e962e 100644
--- a/examples/quick/particles/system/content/startstop.qml
+++ b/examples/quick/particles/system/startstop.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
@@ -80,7 +80,7 @@ Rectangle {
anchors.fill: parent
system: particles
source: "qrc:///particleresources/star.png"
- sizeTable: "../../images/sparkleSize.png"
+ sizeTable: "images/sparkleSize.png"
alpha: 0
colorVariation: 0.6
}
diff --git a/examples/quick/particles/system/system.pro b/examples/quick/particles/system/system.pro
index df143f10a3..ea620f687a 100644
--- a/examples/quick/particles/system/system.pro
+++ b/examples/quick/particles/system/system.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
system.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/system
diff --git a/examples/quick/particles/system/system.qml b/examples/quick/particles/system/system.qml
index 569676d424..9f3af98744 100644
--- a/examples/quick/particles/system/system.qml
+++ b/examples/quick/particles/system/system.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,21 +48,21 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("content/dynamiccomparison.qml"));
- addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("content/startstop.qml"));
- addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("content/timedgroupchanges.qml"));
- addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("content/dynamicemitters.qml"));
- addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("content/multiplepainters.qml"));
+ addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("dynamiccomparison.qml"));
+ addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("startstop.qml"));
+ addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("timedgroupchanges.qml"));
+ addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("dynamicemitters.qml"));
+ addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("multiplepainters.qml"));
}
}
}
diff --git a/examples/quick/particles/system/system.qrc b/examples/quick/particles/system/system.qrc
index 3fb8221fb1..e86bc19e68 100644
--- a/examples/quick/particles/system/system.qrc
+++ b/examples/quick/particles/system/system.qrc
@@ -1,10 +1,13 @@
<RCC>
- <qresource prefix="/particles/system">
+ <qresource prefix="/system">
<file>system.qml</file>
- <file>content/dynamiccomparison.qml</file>
- <file>content/dynamicemitters.qml</file>
- <file>content/multiplepainters.qml</file>
- <file>content/startstop.qml</file>
- <file>content/timedgroupchanges.qml</file>
+ <file>dynamiccomparison.qml</file>
+ <file>dynamicemitters.qml</file>
+ <file>multiplepainters.qml</file>
+ <file>startstop.qml</file>
+ <file>timedgroupchanges.qml</file>
+ <file>images/sparkleSize.png</file>
+ <file>images/particle2.png</file>
+ <file>images/particle3.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/timedgroupchanges.qml
index cab992f898..e3eb0c3d08 100644
--- a/examples/quick/particles/system/content/timedgroupchanges.qml
+++ b/examples/quick/particles/system/timedgroupchanges.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360