Particle examples: use new cmake api
The particles directory contains 5 different examples and a shared directory with some images files. This patch changes the examples to use qt_add_qml_module() in the CMakeLists.txt project files, and changes the .qrc files to directory reference the files needed by the individual projects, which removes the need for images.qrc. (The .pro files still reference the shared.qrc file) The "content" directories located in the different example projects, have been removed, and the containing files have simply been moved to the parent directories instead. Some unused files in the itemparticle example have also been deleted. This example looks very outdated and should ideally be improved, or perhaps simply removed, but I decided to leave it for now. Task-number: QTBUG-98130 Pick-to: 6.2 Change-Id: If05986b4347814715bca50b8d3f6a5cddbf9ced4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
@ -1,5 +1,3 @@
|
|||
# Generated from affectors.pro.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(affectors LANGUAGES CXX)
|
||||
|
||||
|
@ -7,7 +5,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,119 +12,61 @@ endif()
|
|||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/affectors")
|
||||
|
||||
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(affectors
|
||||
add_subdirectory("../../shared" "shared")
|
||||
|
||||
qt_add_executable(affectorsexample WIN32 MACOSX_BUNDLE
|
||||
main.cpp
|
||||
)
|
||||
set_target_properties(affectors PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
target_link_libraries(affectors PUBLIC
|
||||
target_link_libraries(affectorsexample PRIVATE
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Qml
|
||||
Qt::Quick
|
||||
)
|
||||
|
||||
add_dependencies(affectorsexample affectors_shared)
|
||||
|
||||
# Resources:
|
||||
set(affectors_resource_files
|
||||
"affectors.qml"
|
||||
"content/GreyButton.qml"
|
||||
"content/age.qml"
|
||||
"content/attractor.qml"
|
||||
"content/customaffector.qml"
|
||||
"content/friction.qml"
|
||||
"content/gravity.qml"
|
||||
"content/groupgoal.qml"
|
||||
"content/move.qml"
|
||||
"content/spritegoal.qml"
|
||||
"content/turbulence.qml"
|
||||
"content/wander.qml"
|
||||
qt_add_qml_module(affectorsexample
|
||||
URI affectors
|
||||
VERSION 1.0
|
||||
QML_FILES
|
||||
"affectors.qml"
|
||||
"GreyButton.qml"
|
||||
"age.qml"
|
||||
"attractor.qml"
|
||||
"customaffector.qml"
|
||||
"friction.qml"
|
||||
"gravity.qml"
|
||||
"groupgoal.qml"
|
||||
"move.qml"
|
||||
"spritegoal.qml"
|
||||
"turbulence.qml"
|
||||
"wander.qml"
|
||||
RESOURCES
|
||||
"images/snowflake.png"
|
||||
"images/finalfrontier.png"
|
||||
"images/meteor.png"
|
||||
"images/rocket.png"
|
||||
"images/rocket2.png"
|
||||
"images/backgroundLeaves.jpg"
|
||||
"images/realLeaf1.png"
|
||||
"images/realLeaf2.png"
|
||||
"images/realLeaf3.png"
|
||||
"images/realLeaf4.png"
|
||||
"images/particleA.png"
|
||||
"images/matchmask.png"
|
||||
"images/nullRock.png"
|
||||
"images/_explo.png"
|
||||
"images/candle.png"
|
||||
)
|
||||
|
||||
qt6_add_resources(affectors "affectors"
|
||||
PREFIX
|
||||
"/particles/affectors"
|
||||
FILES
|
||||
${affectors_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(affectors "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(affectors "shared"
|
||||
PREFIX
|
||||
"/shared"
|
||||
BASE
|
||||
"../../shared"
|
||||
FILES
|
||||
${shared_resource_files}
|
||||
)
|
||||
|
||||
install(TARGETS affectors
|
||||
install(TARGETS affectorsexample
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
||||
bundle_shared(affectorsexample)
|
||||
|
|
|
@ -4,7 +4,6 @@ QT += quick qml
|
|||
SOURCES += main.cpp
|
||||
RESOURCES += \
|
||||
affectors.qrc \
|
||||
../images.qrc \
|
||||
../../shared/shared.qrc
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/affectors
|
||||
|
|
|
@ -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,26 +48,26 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
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("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("content/age.qml"));
|
||||
addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("content/attractor.qml"));
|
||||
addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("content/customaffector.qml"));
|
||||
addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("content/friction.qml"));
|
||||
addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("content/gravity.qml"));
|
||||
addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("content/groupgoal.qml"));
|
||||
addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("content/move.qml"));
|
||||
addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("content/spritegoal.qml"));
|
||||
addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("content/turbulence.qml"));
|
||||
addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("content/wander.qml"));
|
||||
addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("age.qml"));
|
||||
addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("attractor.qml"));
|
||||
addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("customaffector.qml"));
|
||||
addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("friction.qml"));
|
||||
addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("gravity.qml"));
|
||||
addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("groupgoal.qml"));
|
||||
addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("move.qml"));
|
||||
addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("spritegoal.qml"));
|
||||
addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("turbulence.qml"));
|
||||
addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("wander.qml"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,31 @@
|
|||
<RCC>
|
||||
<qresource prefix="/particles/affectors">
|
||||
<qresource prefix="/affectors">
|
||||
<file>affectors.qml</file>
|
||||
<file>content/age.qml</file>
|
||||
<file>content/attractor.qml</file>
|
||||
<file>content/customaffector.qml</file>
|
||||
<file>content/friction.qml</file>
|
||||
<file>content/gravity.qml</file>
|
||||
<file>content/GreyButton.qml</file>
|
||||
<file>content/groupgoal.qml</file>
|
||||
<file>content/move.qml</file>
|
||||
<file>content/spritegoal.qml</file>
|
||||
<file>content/turbulence.qml</file>
|
||||
<file>content/wander.qml</file>
|
||||
<file>age.qml</file>
|
||||
<file>attractor.qml</file>
|
||||
<file>customaffector.qml</file>
|
||||
<file>friction.qml</file>
|
||||
<file>gravity.qml</file>
|
||||
<file>GreyButton.qml</file>
|
||||
<file>groupgoal.qml</file>
|
||||
<file>move.qml</file>
|
||||
<file>spritegoal.qml</file>
|
||||
<file>turbulence.qml</file>
|
||||
<file>wander.qml</file>
|
||||
<file>images/snowflake.png</file>
|
||||
<file>images/finalfrontier.png</file>
|
||||
<file>images/meteor.png</file>
|
||||
<file>images/rocket.png</file>
|
||||
<file>images/rocket2.png</file>
|
||||
<file>images/backgroundLeaves.jpg</file>
|
||||
<file>images/realLeaf1.png</file>
|
||||
<file>images/realLeaf2.png</file>
|
||||
<file>images/realLeaf3.png</file>
|
||||
<file>images/realLeaf4.png</file>
|
||||
<file>images/particleA.png</file>
|
||||
<file>images/matchmask.png</file>
|
||||
<file>images/nullRock.png</file>
|
||||
<file>images/_explo.png</file>
|
||||
<file>images/candle.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -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
|
||||
|
@ -63,7 +63,7 @@ Rectangle {
|
|||
system: particles
|
||||
sprites: Sprite {
|
||||
name: "snow"
|
||||
source: "../../images/snowflake.png"
|
||||
source: "images/snowflake.png"
|
||||
frameCount: 51
|
||||
frameDuration: 40
|
||||
frameDurationVariation: 8
|
|
@ -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
|
||||
|
@ -57,7 +57,7 @@ Rectangle {
|
|||
height: 540
|
||||
color: "black"
|
||||
Image {
|
||||
source: "../../images/finalfrontier.png"
|
||||
source: "images/finalfrontier.png"
|
||||
anchors.centerIn:parent
|
||||
}
|
||||
ParticleSystem {
|
||||
|
@ -98,7 +98,7 @@ Rectangle {
|
|||
sprites: Sprite {
|
||||
id: spinState
|
||||
name: "spinning"
|
||||
source: "../../images/meteor.png"
|
||||
source: "images/meteor.png"
|
||||
frameCount: 35
|
||||
frameDuration: 60
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
Image {
|
||||
source:"../../images/rocket2.png"
|
||||
source:"images/rocket2.png"
|
||||
id: ship
|
||||
width: 45
|
||||
height: 22
|
|
@ -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,15 +48,15 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Item {
|
||||
width: 360
|
||||
height: 600
|
||||
|
||||
Image {
|
||||
source: "../../images/backgroundLeaves.jpg"
|
||||
source: "images/backgroundLeaves.jpg"
|
||||
anchors.fill: parent
|
||||
}
|
||||
ParticleSystem {
|
||||
|
@ -120,31 +120,31 @@ Item {
|
|||
anchors.fill: parent
|
||||
id: particles
|
||||
sprites: [Sprite {
|
||||
source: "../../images/realLeaf1.png"
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 1
|
||||
to: {"a":1, "b":1, "c":1, "d":1}
|
||||
}, Sprite {
|
||||
name: "a"
|
||||
source: "../../images/realLeaf1.png"
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "b"
|
||||
source: "../../images/realLeaf2.png"
|
||||
source: "images/realLeaf2.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "c"
|
||||
source: "../../images/realLeaf3.png"
|
||||
source: "images/realLeaf3.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "d"
|
||||
source: "../../images/realLeaf4.png"
|
||||
source: "images/realLeaf4.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
Each example is a small QML file emphasizing a particular type or feature.
|
||||
|
||||
Age demonstrates using an Age affector to prematurely end the lives of particles.
|
||||
\snippet particles/affectors/content/age.qml 0
|
||||
\snippet particles/affectors/age.qml 0
|
||||
|
||||
As you move the affector around the screen, the particles inside it
|
||||
(which haven't already been affected) jump to a period near the end
|
||||
|
@ -44,7 +44,7 @@
|
|||
the end of their life instantly.
|
||||
|
||||
Attractor demonstrates using an Attractor affector to simulate a black hole
|
||||
\snippet particles/affectors/content/attractor.qml 0
|
||||
\snippet particles/affectors/attractor.qml 0
|
||||
|
||||
All particles in the scene, including the rocket ship's exhaust and pellets, are pulled
|
||||
towards the black hole. This effect is stronger closer to the black hole, so the
|
||||
|
@ -55,58 +55,58 @@
|
|||
Custom Affector manipulates the properties of the particles directly in javascript.
|
||||
One Affector is used to make the leaves rock back and forth as they fall, looking more
|
||||
leaf-like than just spinning in circles:
|
||||
\snippet particles/affectors/content/customaffector.qml 0
|
||||
\snippet particles/affectors/customaffector.qml 0
|
||||
Another is used to provide a slightly varying friction to the leaves as they 'land',
|
||||
to look more natural:
|
||||
\snippet particles/affectors/content/customaffector.qml 1
|
||||
\snippet particles/affectors/customaffector.qml 1
|
||||
|
||||
Friction is similar to the falling leaves in the custom affector, except that it uses a
|
||||
flat friction the whole way down instead of custom affectors.
|
||||
\snippet particles/affectors/content/friction.qml 0
|
||||
\snippet particles/affectors/friction.qml 0
|
||||
|
||||
Gravity is a convenience affector for applying a constant acceleration to particles inside it
|
||||
\snippet particles/affectors/content/gravity.qml 0
|
||||
\snippet particles/affectors/gravity.qml 0
|
||||
|
||||
GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various
|
||||
ways to transition between them.
|
||||
\snippet particles/affectors/content/groupgoal.qml unlit
|
||||
\snippet particles/affectors/groupgoal.qml unlit
|
||||
The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also
|
||||
have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding
|
||||
with particles in the lit group, and cause them to move to the lighting group.
|
||||
\snippet particles/affectors/content/groupgoal.qml lighting
|
||||
\snippet particles/affectors/groupgoal.qml lighting
|
||||
lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically
|
||||
moves into the lit group after 100ms.
|
||||
\snippet particles/affectors/content/groupgoal.qml lit
|
||||
\snippet particles/affectors/groupgoal.qml lit
|
||||
The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere.
|
||||
There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group
|
||||
(and then to the lit group).
|
||||
\snippet particles/affectors/content/groupgoal.qml groupgoal-pilot
|
||||
\snippet particles/affectors/groupgoal.qml groupgoal-pilot
|
||||
The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame,
|
||||
they go straight to lit because the pilot flame is so hot.
|
||||
\snippet particles/affectors/content/groupgoal.qml groupgoal-ma
|
||||
\snippet particles/affectors/groupgoal.qml groupgoal-ma
|
||||
The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which
|
||||
is hard due to their constant movement) causes them to move to the lighting group.
|
||||
|
||||
Move shows some simple effects you can get by altering trajectory midway.
|
||||
The red particles have an affector that affects their position, jumping them forwards by 120px.
|
||||
\snippet particles/affectors/content/move.qml A
|
||||
\snippet particles/affectors/move.qml A
|
||||
The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction
|
||||
velocity to their existing forwards velocity, they begin to spray off in a cone.
|
||||
\snippet particles/affectors/content/move.qml B
|
||||
\snippet particles/affectors/move.qml B
|
||||
The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of
|
||||
adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases.
|
||||
\snippet particles/affectors/content/move.qml C
|
||||
\snippet particles/affectors/move.qml C
|
||||
|
||||
SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle.
|
||||
\snippet particles/affectors/content/spritegoal.qml 0
|
||||
\snippet particles/affectors/spritegoal.qml 0
|
||||
The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites,
|
||||
it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces.
|
||||
|
||||
Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect.
|
||||
\snippet particles/affectors/content/turbulence.qml 0
|
||||
\snippet particles/affectors/turbulence.qml 0
|
||||
To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source).
|
||||
|
||||
Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down.
|
||||
\snippet particles/affectors/content/wander.qml 0
|
||||
\snippet particles/affectors/wander.qml 0
|
||||
There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference.
|
||||
*/
|
||||
|
|
|
@ -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,15 +48,15 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Item {
|
||||
width: 360
|
||||
height: 600
|
||||
|
||||
Image {
|
||||
source: "../../images/backgroundLeaves.jpg"
|
||||
source: "images/backgroundLeaves.jpg"
|
||||
anchors.fill: parent
|
||||
}
|
||||
ParticleSystem {
|
||||
|
@ -73,31 +73,31 @@ Item {
|
|||
anchors.fill: parent
|
||||
id: particles
|
||||
sprites: [Sprite {
|
||||
source: "../../images/realLeaf1.png"
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 1
|
||||
to: {"a":1, "b":1, "c":1, "d":1}
|
||||
}, Sprite {
|
||||
name: "a"
|
||||
source: "../../images/realLeaf1.png"
|
||||
source: "images/realLeaf1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "b"
|
||||
source: "../../images/realLeaf2.png"
|
||||
source: "images/realLeaf2.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "c"
|
||||
source: "../../images/realLeaf3.png"
|
||||
source: "images/realLeaf3.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
},
|
||||
Sprite {
|
||||
name: "d"
|
||||
source: "../../images/realLeaf4.png"
|
||||
source: "images/realLeaf4.png"
|
||||
frameCount: 1
|
||||
frameDuration: 10000
|
||||
}
|
|
@ -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
|
||||
|
||||
Item {
|
||||
id: window
|
||||
|
@ -109,7 +109,7 @@ Item {
|
|||
ImageParticle {
|
||||
anchors.fill: parent
|
||||
system: sys
|
||||
source: "../../images/realLeaf1.png"
|
||||
source: "images/realLeaf1.png"
|
||||
}
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
@ -74,7 +74,7 @@ Rectangle {
|
|||
duration: 1000
|
||||
to: {"lighting":1, "unlit":99}
|
||||
ImageParticle {
|
||||
source: "../../images/particleA.png"
|
||||
source: "images/particleA.png"
|
||||
colorVariation: 0.1
|
||||
color: "#2060160f"
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ Rectangle {
|
|||
id: flame
|
||||
anchors.fill: parent
|
||||
groups: ["flame", "lit", "lighting"]
|
||||
source: "../../images/particleA.png"
|
||||
source: "images/particleA.png"
|
||||
colorVariation: 0.1
|
||||
color: "#00ff400f"
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ Rectangle {
|
|||
y: -55
|
||||
height: 75
|
||||
width: 30
|
||||
shape: MaskShape {source: "../../images/matchmask.png"}
|
||||
shape: MaskShape {source: "images/matchmask.png"}
|
||||
}
|
||||
// ![groupgoal-pilot]
|
||||
}
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 679 KiB After Width: | Height: | Size: 679 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 870 B After Width: | Height: | Size: 870 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
|
@ -48,4 +48,4 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(particles/affectors/affectors)
|
||||
DECLARATIVE_EXAMPLE_MAIN(affectors/affectors)
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -62,7 +62,7 @@ Item {
|
|||
|
||||
ParticleSystem { id: sys }
|
||||
Image {
|
||||
source: "../../images/finalfrontier.png"
|
||||
source: "images/finalfrontier.png"
|
||||
transformOrigin: Item.Center
|
||||
anchors.centerIn: parent
|
||||
NumberAnimation on rotation {
|
||||
|
@ -113,20 +113,20 @@ Item {
|
|||
sprites:[Sprite {
|
||||
id: spinState
|
||||
name: "spinning"
|
||||
source: "../../images/meteor.png"
|
||||
source: "images/meteor.png"
|
||||
frameCount: 35
|
||||
frameDuration: 40
|
||||
randomStart: true
|
||||
to: {"explode":0, "spinning":1}
|
||||
},Sprite {
|
||||
name: "explode"
|
||||
source: "../../images/_explo.png"
|
||||
source: "images/_explo.png"
|
||||
frameCount: 22
|
||||
frameDuration: 40
|
||||
to: {"nullFrame":1}
|
||||
},Sprite {//Not sure if this is needed, but seemed easiest
|
||||
name: "nullFrame"
|
||||
source: "../../images/nullRock.png"
|
||||
source: "images/nullRock.png"
|
||||
frameCount: 1
|
||||
frameDuration: 1000
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ Item {
|
|||
//! [0]
|
||||
Image {
|
||||
id: rocketShip
|
||||
source: "../../images/rocket.png"
|
||||
source: "images/rocket.png"
|
||||
anchors.centerIn: holder
|
||||
rotation: (circle.percent+0.25) * 360
|
||||
z: 2
|
|
@ -48,8 +48,8 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Rectangle {
|
||||
width: 320
|
||||
|
@ -57,7 +57,7 @@ Rectangle {
|
|||
color: "#222222"
|
||||
id: root
|
||||
Image {
|
||||
source: "../../images/candle.png"
|
||||
source: "images/candle.png"
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottomMargin: -60
|
|
@ -48,8 +48,8 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Rectangle {
|
||||
width: 360
|
||||
|
@ -59,7 +59,7 @@ Rectangle {
|
|||
system: particles
|
||||
sprites: Sprite {
|
||||
name: "snow"
|
||||
source: "../../images/snowflake.png"
|
||||
source: "images/snowflake.png"
|
||||
frameCount: 51
|
||||
frameDuration: 40
|
||||
frameDurationVariation: 8
|
|
@ -1,5 +1,3 @@
|
|||
# Generated from emitters.pro.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(emitters LANGUAGES CXX)
|
||||
|
||||
|
@ -7,7 +5,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,115 +12,44 @@ endif()
|
|||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/emitters")
|
||||
|
||||
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(emitters
|
||||
add_subdirectory("../../shared" "shared")
|
||||
|
||||
qt_add_executable(emittersexample WIN32 MACOSX_BUNDLE
|
||||
main.cpp
|
||||
)
|
||||
set_target_properties(emitters PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
target_link_libraries(emitters PUBLIC
|
||||
target_link_libraries(emittersexample PUBLIC
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Qml
|
||||
Qt::Quick
|
||||
)
|
||||
|
||||
add_dependencies(emittersexample emitters_shared)
|
||||
|
||||
# Resources:
|
||||
set(emitters_resource_files
|
||||
"content/burstandpulse.qml"
|
||||
"content/customemitter.qml"
|
||||
"content/emitmask.qml"
|
||||
"content/maximumemitted.qml"
|
||||
"content/shapeanddirection.qml"
|
||||
"content/trailemitter.qml"
|
||||
"content/velocityfrommotion.qml"
|
||||
"emitters.qml"
|
||||
qt_add_qml_module(emittersexample
|
||||
URI emitters
|
||||
VERSION 1.0
|
||||
QML_FILES
|
||||
"burstandpulse.qml"
|
||||
"customemitter.qml"
|
||||
"emitmask.qml"
|
||||
"maximumemitted.qml"
|
||||
"shapeanddirection.qml"
|
||||
"trailemitter.qml"
|
||||
"velocityfrommotion.qml"
|
||||
"emitters.qml"
|
||||
RESOURCES
|
||||
"images/portal_bg.png"
|
||||
"images/starfish_mask.png"
|
||||
)
|
||||
|
||||
qt6_add_resources(emitters "emitters"
|
||||
PREFIX
|
||||
"/particles/emitters"
|
||||
FILES
|
||||
${emitters_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(emitters "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(emitters "shared"
|
||||
PREFIX
|
||||
"/shared"
|
||||
BASE
|
||||
"../../shared"
|
||||
FILES
|
||||
${shared_resource_files}
|
||||
)
|
||||
|
||||
install(TARGETS emitters
|
||||
install(TARGETS emittersexample
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
||||
bundle_shared(emittersexample)
|
||||
|
|
|
@ -34,27 +34,27 @@
|
|||
Each example is a small QML file emphasizing a particular type or feature.
|
||||
|
||||
Velocity from motion gives the effect of strong particle motion through primarily moving the emitters:
|
||||
\snippet particles/emitters/content/velocityfrommotion.qml 0
|
||||
\snippet particles/emitters/velocityfrommotion.qml 0
|
||||
|
||||
Burst and pulse calls the burst and pulse methods on two idential emitters.
|
||||
\snippet particles/emitters/content/burstandpulse.qml 0
|
||||
\snippet particles/emitters/burstandpulse.qml 0
|
||||
Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for.
|
||||
This gives a slightly different behaviour, which is easy to see in this example.
|
||||
|
||||
Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted;
|
||||
\snippet particles/emitters/content/customemitter.qml 0
|
||||
\snippet particles/emitters/customemitter.qml 0
|
||||
This is used to emit curving particles in six rotating spokes.
|
||||
|
||||
Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape.
|
||||
\snippet particles/emitters/content/emitmask.qml 0
|
||||
\snippet particles/emitters/emitmask.qml 0
|
||||
|
||||
Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached.
|
||||
|
||||
Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection
|
||||
\snippet particles/emitters/content/shapeanddirection.qml 0
|
||||
\snippet particles/emitters/shapeanddirection.qml 0
|
||||
This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center.
|
||||
|
||||
TrailEmitter uses that type to add smoke particles to trail the fire particles in the scene.
|
||||
\snippet particles/emitters/content/customemitter.qml 0
|
||||
\snippet particles/emitters/customemitter.qml 0
|
||||
|
||||
*/
|
||||
|
|
|
@ -75,7 +75,7 @@ Rectangle {
|
|||
size: 10
|
||||
//! [0]
|
||||
shape: MaskShape {
|
||||
source: "../../images/starfish_mask.png"
|
||||
source: "images/starfish_mask.png"
|
||||
}
|
||||
//! [0]
|
||||
}
|
|
@ -4,7 +4,6 @@ QT += quick qml
|
|||
SOURCES += main.cpp
|
||||
RESOURCES += \
|
||||
emitters.qrc \
|
||||
../images.qrc \
|
||||
../../shared/shared.qrc
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/emitters
|
||||
|
|
|
@ -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,23 +48,23 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
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("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("content/velocityfrommotion.qml"));
|
||||
addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("content/burstandpulse.qml"));
|
||||
addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("content/customemitter.qml"));
|
||||
addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("content/emitmask.qml"));
|
||||
addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("content/maximumemitted.qml"));
|
||||
addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("content/shapeanddirection.qml"));
|
||||
addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("content/trailemitter.qml"));
|
||||
addExample("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("velocityfrommotion.qml"));
|
||||
addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("burstandpulse.qml"));
|
||||
addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("customemitter.qml"));
|
||||
addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("emitmask.qml"));
|
||||
addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("maximumemitted.qml"));
|
||||
addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("shapeanddirection.qml"));
|
||||
addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("trailemitter.qml"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<RCC>
|
||||
<qresource prefix="/particles/emitters">
|
||||
<qresource prefix="/emitters">
|
||||
<file>emitters.qml</file>
|
||||
<file>content/burstandpulse.qml</file>
|
||||
<file>content/customemitter.qml</file>
|
||||
<file>content/emitmask.qml</file>
|
||||
<file>content/maximumemitted.qml</file>
|
||||
<file>content/shapeanddirection.qml</file>
|
||||
<file>content/trailemitter.qml</file>
|
||||
<file>content/velocityfrommotion.qml</file>
|
||||
<file>burstandpulse.qml</file>
|
||||
<file>customemitter.qml</file>
|
||||
<file>emitmask.qml</file>
|
||||
<file>maximumemitted.qml</file>
|
||||
<file>shapeanddirection.qml</file>
|
||||
<file>trailemitter.qml</file>
|
||||
<file>velocityfrommotion.qml</file>
|
||||
<file>images/starfish_mask.png</file>
|
||||
<file>images/portal_bg.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
@ -48,4 +48,4 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(particles/emitters/emitters)
|
||||
DECLARATIVE_EXAMPLE_MAIN(emitters/emitters)
|
||||
|
|
|
@ -58,7 +58,7 @@ Rectangle {
|
|||
color: "black"
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: "../../images/portal_bg.png"
|
||||
source: "images/portal_bg.png"
|
||||
}
|
||||
|
||||
ParticleSystem {
|
|
@ -1,5 +1,3 @@
|
|||
# Generated from imageparticle.pro.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(imageparticle LANGUAGES CXX)
|
||||
|
||||
|
@ -7,7 +5,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,115 +12,50 @@ endif()
|
|||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/imageparticle")
|
||||
|
||||
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(imageparticle
|
||||
add_subdirectory("../../shared" "shared")
|
||||
|
||||
qt_add_executable(imageparticleexample WIN32 MACOSX_BUNDLE
|
||||
main.cpp
|
||||
)
|
||||
set_target_properties(imageparticle PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
target_link_libraries(imageparticle PUBLIC
|
||||
target_link_libraries(imageparticleexample PUBLIC
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Qml
|
||||
Qt::Quick
|
||||
)
|
||||
|
||||
add_dependencies(imageparticleexample imageparticle_shared)
|
||||
|
||||
# Resources:
|
||||
set(imageparticle_resource_files
|
||||
"content/allatonce.qml"
|
||||
"content/colored.qml"
|
||||
"content/colortable.qml"
|
||||
"content/deformation.qml"
|
||||
"content/rotation.qml"
|
||||
"content/sharing.qml"
|
||||
"content/sprites.qml"
|
||||
"imageparticle.qml"
|
||||
qt_add_qml_module(imageparticleexample
|
||||
URI imageparticle
|
||||
VERSION 1.0
|
||||
QML_FILES
|
||||
"allatonce.qml"
|
||||
"colored.qml"
|
||||
"colortable.qml"
|
||||
"deformation.qml"
|
||||
"imageparticle.qml"
|
||||
"rotation.qml"
|
||||
"sharing.qml"
|
||||
"sprites.qml"
|
||||
RESOURCES
|
||||
"images/bear_tiles.png"
|
||||
"images/colortable.png"
|
||||
"images/starfish_0.png"
|
||||
"images/starfish_1.png"
|
||||
"images/starfish_2.png"
|
||||
"images/starfish_3.png"
|
||||
"images/starfish_4.png"
|
||||
"images/flower.png"
|
||||
)
|
||||
|
||||
qt6_add_resources(imageparticle "imageparticle"
|
||||
PREFIX
|
||||
"/particles/imageparticle"
|
||||
FILES
|
||||
${imageparticle_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(imageparticle "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(imageparticle "shared"
|
||||
PREFIX
|
||||
"/shared"
|
||||
BASE
|
||||
"../../shared"
|
||||
FILES
|
||||
${shared_resource_files}
|
||||
)
|
||||
|
||||
install(TARGETS imageparticle
|
||||
install(TARGETS imageparticleexample
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
||||
bundle_shared(imageparticleexample)
|
||||
|
|
|
@ -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 {
|
||||
color: "white"
|
||||
|
@ -64,14 +64,14 @@ Rectangle {
|
|||
sprites: [
|
||||
Sprite {
|
||||
name: "bear"
|
||||
source: "../../images/bear_tiles.png"
|
||||
source: "images/bear_tiles.png"
|
||||
frameCount: 13
|
||||
frameDuration: 120
|
||||
}
|
||||
]
|
||||
colorVariation: 0.5
|
||||
rotationVelocityVariation: 360
|
||||
colorTable: "../../images/colortable.png"
|
||||
colorTable: "images/colortable.png"
|
||||
// ![0]
|
||||
system: sys
|
||||
}
|
|
@ -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
|
|
@ -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.Particles 2.0
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@ -66,8 +66,8 @@ Rectangle {
|
|||
|
||||
//! [0]
|
||||
source: "qrc:///particleresources/glowdot.png"
|
||||
colorTable: "../../images/colortable.png"
|
||||
sizeTable: "../../images/colortable.png"
|
||||
colorTable: "images/colortable.png"
|
||||
sizeTable: "images/colortable.png"
|
||||
//! [0]
|
||||
}
|
||||
|
|
@ -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 {
|
||||
color: "goldenrod"
|
||||
|
@ -61,7 +61,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
system: sys
|
||||
groups: ["goingLeft", "goingRight"]
|
||||
source: "../../images/starfish_4.png"
|
||||
source: "images/starfish_4.png"
|
||||
rotation: 90
|
||||
rotationVelocity: 90
|
||||
autoRotation: true
|
||||
|
@ -71,7 +71,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
system: sys
|
||||
groups: ["goingDown"]
|
||||
source: "../../images/starfish_0.png"
|
||||
source: "images/starfish_0.png"
|
||||
rotation: 180
|
||||
yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
|
||||
}
|
|
@ -35,25 +35,25 @@
|
|||
Each example is a small QML file emphasizing a particular type or feature.
|
||||
|
||||
All at once shows off several of the features of ImageParticle at the same time.
|
||||
\snippet particles/imageparticle/content/allatonce.qml 0
|
||||
\snippet particles/imageparticle/allatonce.qml 0
|
||||
|
||||
Colored shows a simple ImageParticle with some color variation.
|
||||
\snippet particles/imageparticle/content/colored.qml 0
|
||||
\snippet particles/imageparticle/colored.qml 0
|
||||
|
||||
Color Table sets the color over life on the particles to provide a fixed rainbow effect.
|
||||
\snippet particles/imageparticle/content/colortable.qml 0
|
||||
\snippet particles/imageparticle/colortable.qml 0
|
||||
|
||||
Deformation spins and squishes a starfish particle.
|
||||
\snippet particles/imageparticle/content/deformation.qml spin
|
||||
\snippet particles/imageparticle/content/deformation.qml deform
|
||||
\snippet particles/imageparticle/deformation.qml spin
|
||||
\snippet particles/imageparticle/deformation.qml deform
|
||||
|
||||
Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel.
|
||||
|
||||
Sharing demonstrates what happens when multiple ImageParticles try to render the same particle.
|
||||
The following ImageParticle renders the particles inside the ListView:
|
||||
\snippet particles/imageparticle/content/sharing.qml 0
|
||||
\snippet particles/imageparticle/sharing.qml 0
|
||||
The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle.
|
||||
\snippet particles/imageparticle/content/sharing.qml 1
|
||||
\snippet particles/imageparticle/sharing.qml 1
|
||||
Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color.
|
||||
Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both.
|
||||
Note that you can undo rotation in another ImageParticle, you just need to explicitly set rotationVariation to 0.
|
||||
|
|
|
@ -4,7 +4,6 @@ QT += quick qml
|
|||
SOURCES += main.cpp
|
||||
RESOURCES += \
|
||||
imageparticle.qrc \
|
||||
../images.qrc \
|
||||
../../shared/shared.qrc
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/imageparticle
|
||||
|
|
|
@ -48,23 +48,23 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
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("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("content/allatonce.qml"));
|
||||
addExample("Colored", "Colorized image particles", Qt.resolvedUrl("content/colored.qml"));
|
||||
addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("content/colortable.qml"));
|
||||
addExample("Deformation", "Deformed particles", Qt.resolvedUrl("content/deformation.qml"));
|
||||
addExample("Rotation", "Rotated particles", Qt.resolvedUrl("content/rotation.qml"));
|
||||
addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("content/sharing.qml"));
|
||||
addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("content/sprites.qml"));
|
||||
addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("allatonce.qml"));
|
||||
addExample("Colored", "Colorized image particles", Qt.resolvedUrl("colored.qml"));
|
||||
addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("colortable.qml"));
|
||||
addExample("Deformation", "Deformed particles", Qt.resolvedUrl("deformation.qml"));
|
||||
addExample("Rotation", "Rotated particles", Qt.resolvedUrl("rotation.qml"));
|
||||
addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("sharing.qml"));
|
||||
addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("sprites.qml"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
<RCC>
|
||||
<qresource prefix="/particles/imageparticle">
|
||||
<qresource prefix="/imageparticle">
|
||||
<file>imageparticle.qml</file>
|
||||
<file>content/allatonce.qml</file>
|
||||
<file>content/colored.qml</file>
|
||||
<file>content/colortable.qml</file>
|
||||
<file>content/deformation.qml</file>
|
||||
<file>content/rotation.qml</file>
|
||||
<file>content/sharing.qml</file>
|
||||
<file>content/sprites.qml</file>
|
||||
<file>allatonce.qml</file>
|
||||
<file>colored.qml</file>
|
||||
<file>colortable.qml</file>
|
||||
<file>deformation.qml</file>
|
||||
<file>rotation.qml</file>
|
||||
<file>sharing.qml</file>
|
||||
<file>sprites.qml</file>
|
||||
<file>images/bear_tiles.png</file>
|
||||
<file>images/colortable.png</file>
|
||||
<file>images/starfish_0.png</file>
|
||||
<file>images/starfish_1.png</file>
|
||||
<file>images/starfish_2.png</file>
|
||||
<file>images/starfish_3.png</file>
|
||||
<file>images/starfish_4.png</file>
|
||||
<file>images/flower.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -48,4 +48,4 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(particles/imageparticle/imageparticle)
|
||||
DECLARATIVE_EXAMPLE_MAIN(imageparticle/imageparticle)
|
||||
|
|
|
@ -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 {
|
||||
color: "goldenrod"
|
||||
|
@ -59,7 +59,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
id: up
|
||||
system: sys
|
||||
source: "../../images/starfish_2.png"
|
||||
source: "images/starfish_2.png"
|
||||
autoRotation: true //leaving these two settings at default allows you to test going up performance levels
|
||||
rotation: -90
|
||||
}
|
|
@ -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.
|
||||
|
@ -52,8 +52,8 @@
|
|||
// that uses a SpringAnimation to provide custom movement when the
|
||||
// highlight bar is moved between items.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@ -108,7 +108,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
anchors.fill: parent
|
||||
system: particles
|
||||
source: "../../images/flower.png"
|
||||
source: "images/flower.png"
|
||||
color: "red"
|
||||
clip: true
|
||||
alpha: 1.0
|
||||
|
@ -147,7 +147,7 @@ Rectangle {
|
|||
ImageParticle {
|
||||
anchors.fill: parent
|
||||
system: particles
|
||||
source: "../../images/flower.png"
|
||||
source: "images/flower.png"
|
||||
alpha: 0.1
|
||||
color: "white"
|
||||
rotationVariation: 180
|
|
@ -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 {
|
||||
color: "lightsteelblue"
|
||||
|
@ -60,7 +60,7 @@ Rectangle {
|
|||
SpriteSequence {
|
||||
sprites: Sprite {
|
||||
name: "bear"
|
||||
source: "../../images/bear_tiles.png"
|
||||
source: "images/bear_tiles.png"
|
||||
frameCount: 13
|
||||
frameDuration: 120
|
||||
}
|
||||
|
@ -80,25 +80,25 @@ Rectangle {
|
|||
system: sys
|
||||
sprites: [Sprite {
|
||||
name: "happy"
|
||||
source: "../../images/starfish_1.png"
|
||||
source: "images/starfish_1.png"
|
||||
frameCount: 1
|
||||
frameDuration: 260
|
||||
to: {"happy": 1, "silly": 1, "angry": 1}
|
||||
}, Sprite {
|
||||
name: "angry"
|
||||
source: "../../images/starfish_0.png"
|
||||
source: "images/starfish_0.png"
|
||||
frameCount: 1
|
||||
frameDuration: 260
|
||||
to: {"happy": 1, "silly": 1, "angry": 1}
|
||||
}, Sprite {
|
||||
name: "silly"
|
||||
source: "../../images/starfish_2.png"
|
||||
source: "images/starfish_2.png"
|
||||
frameCount: 1
|
||||
frameDuration: 260
|
||||
to: {"happy": 1, "silly": 1, "noticedbear": 0}
|
||||
}, Sprite {
|
||||
name: "noticedbear"
|
||||
source: "../../images/starfish_3.png"
|
||||
source: "images/starfish_3.png"
|
||||
frameCount: 1
|
||||
frameDuration: 2600
|
||||
}]
|
|
@ -1,35 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/particles">
|
||||
<file>images/_explo.png</file>
|
||||
<file>images/backgroundLeaves.jpg</file>
|
||||
<file>images/bear_tiles.png</file>
|
||||
<file>images/candle.png</file>
|
||||
<file>images/colortable.png</file>
|
||||
<file>images/finalfrontier.png</file>
|
||||
<file>images/flower.png</file>
|
||||
<file>images/matchmask.png</file>
|
||||
<file>images/meteor_explo.png</file>
|
||||
<file>images/meteor.png</file>
|
||||
<file>images/meteors.png</file>
|
||||
<file>images/nullRock.png</file>
|
||||
<file>images/particle2.png</file>
|
||||
<file>images/particle3.png</file>
|
||||
<file>images/particleA.png</file>
|
||||
<file>images/portal_bg.png</file>
|
||||
<file>images/realLeaf1.png</file>
|
||||
<file>images/realLeaf2.png</file>
|
||||
<file>images/realLeaf3.png</file>
|
||||
<file>images/realLeaf4.png</file>
|
||||
<file>images/rocket.png</file>
|
||||
<file>images/rocket2.png</file>
|
||||
<file>images/sizeInOut.png</file>
|
||||
<file>images/snowflake.png</file>
|
||||
<file>images/sparkleSize.png</file>
|
||||
<file>images/starfish_0.png</file>
|
||||
<file>images/starfish_1.png</file>
|
||||
<file>images/starfish_2.png</file>
|
||||
<file>images/starfish_3.png</file>
|
||||
<file>images/starfish_4.png</file>
|
||||
<file>images/starfish_mask.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Before Width: | Height: | Size: 215 KiB |
Before Width: | Height: | Size: 129 KiB |
Before Width: | Height: | Size: 132 B |
|
@ -1,13 +1,9 @@
|
|||
# Generated from itemparticle.pro.
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(itemparticle 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,119 +11,38 @@ endif()
|
|||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/itemparticle")
|
||||
|
||||
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(itemparticle
|
||||
add_subdirectory("../../shared" "shared")
|
||||
|
||||
qt_add_executable(itemparticleexample WIN32 MACOSX_BUNDLE
|
||||
main.cpp
|
||||
)
|
||||
set_target_properties(itemparticle PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
target_link_libraries(itemparticle PUBLIC
|
||||
target_link_libraries(itemparticleexample PUBLIC
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Qml
|
||||
Qt::Quick
|
||||
)
|
||||
|
||||
|
||||
file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "content/*")
|
||||
foreach(file IN LISTS resource_glob_0)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
|
||||
endforeach()
|
||||
|
||||
file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*qml")
|
||||
foreach(file IN LISTS resource_glob_1)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
|
||||
endforeach()
|
||||
add_dependencies(itemparticleexample itemparticle_shared)
|
||||
|
||||
# Resources:
|
||||
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"
|
||||
qt_add_qml_module(itemparticleexample
|
||||
URI itemparticle
|
||||
VERSION 1.0
|
||||
QML_FILES
|
||||
"itemparticle.qml"
|
||||
"delegates.qml"
|
||||
"script.js"
|
||||
RESOURCES
|
||||
"images/rocket.png"
|
||||
)
|
||||
|
||||
qt6_add_resources(itemparticle "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(itemparticle "shared"
|
||||
PREFIX
|
||||
"/shared"
|
||||
BASE
|
||||
"../../shared"
|
||||
FILES
|
||||
${shared_resource_files}
|
||||
)
|
||||
set(qmake_immediate_resource_files
|
||||
${resource_glob_0}
|
||||
${resource_glob_1}
|
||||
)
|
||||
|
||||
qt6_add_resources(itemparticle "qmake_immediate"
|
||||
PREFIX
|
||||
"/"
|
||||
FILES
|
||||
${qmake_immediate_resource_files}
|
||||
)
|
||||
|
||||
install(TARGETS itemparticle
|
||||
install(TARGETS itemparticleexample
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
||||
bundle_shared(itemparticleexample)
|
||||
|
|
|
@ -1,98 +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
|
||||
|
||||
//![0]
|
||||
Package {
|
||||
Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
|
||||
Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width: 200; height: 25
|
||||
color: 'lightsteelblue'
|
||||
|
||||
Text { text: display; anchors.centerIn: parent }
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (wrapper.state == 'inList')
|
||||
wrapper.state = 'inGrid';
|
||||
else
|
||||
wrapper.state = 'inList';
|
||||
}
|
||||
}
|
||||
|
||||
state: 'inList'
|
||||
states: [
|
||||
State {
|
||||
name: 'inList'
|
||||
ParentChange { target: wrapper; parent: listDelegate }
|
||||
},
|
||||
State {
|
||||
name: 'inGrid'
|
||||
ParentChange {
|
||||
target: wrapper; parent: gridDelegate
|
||||
x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
ParentAnimation {
|
||||
NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
//![0]
|
|
@ -1,88 +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
|
||||
|
||||
//![0]
|
||||
Package {
|
||||
Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' }
|
||||
Item { id: particleDelegate; width: w; height: h; Package.name: 'particles'
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width: w; height: h;
|
||||
color: col
|
||||
rotation: Math.random()*360
|
||||
Behavior on rotation {RotationAnimation {}}
|
||||
|
||||
states: State {
|
||||
name: "gridded"
|
||||
when: root.inGrid
|
||||
PropertyChanges {
|
||||
wrapper.rotation: 0
|
||||
}
|
||||
ParentChange {
|
||||
target: wrapper
|
||||
parent: gridDelegate
|
||||
x:0
|
||||
y:0
|
||||
}
|
||||
}
|
||||
transitions: [
|
||||
Transition {
|
||||
ParentAnimation {
|
||||
NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
//![0]
|
|
@ -1,236 +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
|
||||
import "../../../modelviews/listview/content"
|
||||
|
||||
// This example illustrates expanding a list item to show a more detailed view.
|
||||
|
||||
// Delegate for the recipes. This delegate has two modes:
|
||||
// 1. List mode (default), which just shows the picture and title of the recipe.
|
||||
// 2. Details mode, which also shows the ingredients and method.
|
||||
Component {
|
||||
id: recipeDelegate
|
||||
|
||||
Item {
|
||||
id: recipe
|
||||
|
||||
// Create a property to contain the visibility of the details.
|
||||
// We can bind multiple element's opacity to this one property,
|
||||
// rather than having a "PropertyChanges" line for each element we
|
||||
// want to fade.
|
||||
property real detailsOpacity : 0
|
||||
|
||||
//this bit changed for aesthetics
|
||||
width: 70
|
||||
height: 70
|
||||
// A simple rounded rectangle for the background
|
||||
Rectangle {
|
||||
id: background
|
||||
x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
|
||||
color: "ivory"
|
||||
border.color: "orange"
|
||||
radius: 5
|
||||
antialiasing: true
|
||||
}
|
||||
Image {
|
||||
anchors.fill:parent
|
||||
anchors.margins: -32
|
||||
source: "bubble.png"
|
||||
}
|
||||
|
||||
|
||||
// This mouse region covers the entire delegate.
|
||||
// When clicked it changes mode to 'Details'. If we are already
|
||||
// in Details mode, then no change will happen.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: recipe.state = 'Details';
|
||||
}
|
||||
|
||||
// Lay out the page: picture, title and ingredients at the top, and method at the
|
||||
// bottom. Note that elements that should not be visible in the list
|
||||
// mode have their opacity set to recipe.detailsOpacity.
|
||||
Row {
|
||||
id: topLayout
|
||||
x: 10; y: 10; height: recipeImage.height; width: parent.width
|
||||
spacing: 10
|
||||
|
||||
Image {
|
||||
id: recipeImage
|
||||
width: 50; height: 50
|
||||
source: "../../modelviews/listview/" + picture
|
||||
}
|
||||
|
||||
Column {
|
||||
width: background.width - recipeImage.width - 20; height: recipeImage.height
|
||||
spacing: 5
|
||||
|
||||
Text {
|
||||
text: title
|
||||
font.bold: true; font.pointSize: 16
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Ingredients"
|
||||
font.pointSize: 12; font.bold: true
|
||||
opacity: recipe.detailsOpacity
|
||||
}
|
||||
|
||||
Text {
|
||||
text: ingredients
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
opacity: recipe.detailsOpacity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: details
|
||||
x: 10; width: parent.width - 20
|
||||
anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
|
||||
opacity: recipe.detailsOpacity
|
||||
|
||||
Text {
|
||||
id: methodTitle
|
||||
anchors.top: parent.top
|
||||
text: "Method"
|
||||
font.pointSize: 12; font.bold: true
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
width: parent.width
|
||||
anchors { top: methodTitle.bottom; bottom: parent.bottom }
|
||||
contentHeight: methodText.height
|
||||
clip: true
|
||||
|
||||
Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
|
||||
}
|
||||
|
||||
Image {
|
||||
anchors { right: flick.right; top: flick.top }
|
||||
source: "../../modelviews/listview/" + "content/pics/moreUp.png"
|
||||
opacity: flick.atYBeginning ? 0 : 1
|
||||
}
|
||||
|
||||
Image {
|
||||
anchors { right: flick.right; bottom: flick.bottom }
|
||||
source: "../../modelviews/listview/" + "content/pics/moreDown.png"
|
||||
opacity: flick.atYEnd ? 0 : 1
|
||||
}
|
||||
}
|
||||
|
||||
// A button to close the detailed view, i.e. set the state back to default ('').
|
||||
TextButton {
|
||||
y: 10
|
||||
anchors { right: background.right; rightMargin: 10 }
|
||||
opacity: recipe.detailsOpacity
|
||||
text: "Close"
|
||||
|
||||
onClicked: recipe.state = '';
|
||||
}
|
||||
|
||||
states: State {
|
||||
name: "Details"
|
||||
|
||||
PropertyChanges {
|
||||
background.color: "white"
|
||||
recipeImage {
|
||||
// Make picture bigger
|
||||
width: 130
|
||||
height: 130
|
||||
}
|
||||
recipe {
|
||||
// Make details visible
|
||||
detailsOpacity: 1
|
||||
x: 0
|
||||
opacity: 1
|
||||
|
||||
// Fill the entire list area with the detailed view
|
||||
height: root.height
|
||||
width: root.height
|
||||
x:0
|
||||
y:0
|
||||
z:100
|
||||
}
|
||||
}
|
||||
|
||||
// Move the list so that this item is at the top and
|
||||
// disallow flicking while we're in detailed view
|
||||
// PropertyChanges {
|
||||
// recipe.ListView.view {
|
||||
// explicit: true
|
||||
// contentY: recipe.y
|
||||
// interactive: false
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
//The only strictly necessary particle specific lines
|
||||
to: "Details"
|
||||
reversible: true
|
||||
ScriptAction {script: {
|
||||
if(state == "Details")
|
||||
mp.freeze(index);
|
||||
else
|
||||
mp.unfreeze(index);
|
||||
}
|
||||
}
|
||||
// Make the state changes smooth
|
||||
ParallelAnimation {
|
||||
ColorAnimation { property: "color"; duration: 500 }
|
||||
NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.3 KiB |
|
@ -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;
|
||||
|
|
After Width: | Height: | Size: 7.1 KiB |
|
@ -3,10 +3,8 @@ TEMPLATE = app
|
|||
QT += quick qml
|
||||
SOURCES += main.cpp
|
||||
RESOURCES += \
|
||||
../images.qrc \
|
||||
../../shared/shared.qrc \
|
||||
$$files("content/*") \
|
||||
$$files("*qml")
|
||||
itemparticle.qrc \
|
||||
../../shared/shared.qrc
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/itemparticle
|
||||
INSTALLS += target
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 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,11 +48,10 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Particles 2.12
|
||||
import "shared" as Shared
|
||||
import "content/script.js" as Script
|
||||
import "content"
|
||||
import QtQuick
|
||||
import QtQuick.Particles
|
||||
import shared
|
||||
import "script.js" as Script
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -127,7 +126,7 @@ Item {
|
|||
to: 1
|
||||
}
|
||||
Image {
|
||||
source: "qrc:///particles/images/rocket.png"
|
||||
source: "images/rocket.png"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Text {
|
||||
|
@ -209,7 +208,7 @@ Item {
|
|||
delegate: theDelegate
|
||||
}
|
||||
}
|
||||
Shared.FlickrRssModel {
|
||||
FlickrRssModel {
|
||||
id: flickrModel
|
||||
tags: "particle,particles"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<RCC>
|
||||
<qresource prefix="/itemparticle">
|
||||
<file>itemparticle.qml</file>
|
||||
<file>delegates.qml</file>
|
||||
<file>script.js</file>
|
||||
<file>images/rocket.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -48,4 +48,4 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(particleview)
|
||||
DECLARATIVE_EXAMPLE_MAIN(itemparticle/itemparticle)
|
||||
|
|
|
@ -5,9 +5,6 @@ SUBDIRS += affectors \
|
|||
itemparticle \
|
||||
system
|
||||
|
||||
EXAMPLE_FILES = \
|
||||
images.qrc
|
||||
|
||||
#Install shared images too
|
||||
qml.files = images
|
||||
qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles
|
||||
|
|
|
@ -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"
|
||||
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"
|
||||
)
|
||||
|
||||
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
|
||||
install(TARGETS systemexample
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
||||
|
||||
bundle_shared(systemexample)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
|
@ -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
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
|
@ -48,4 +48,4 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(particles/system/system)
|
||||
DECLARATIVE_EXAMPLE_MAIN(system/system)
|
||||
|
|
|
@ -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 {
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|