2019-03-27 18:38:36 +01:00
|
|
|
import QtQuick 2.12
|
2020-03-06 13:25:20 +01:00
|
|
|
import QtQuick.Controls 2.12
|
2019-03-27 18:38:36 +01:00
|
|
|
import QtQuick.Controls.Material 2.12
|
2019-06-09 12:21:03 +02:00
|
|
|
import QtQuick.Particles 2.12
|
|
|
|
import QtQuick.Shapes 1.12
|
2019-03-27 18:38:36 +01:00
|
|
|
|
|
|
|
Rectangle {
|
2019-06-09 12:21:03 +02:00
|
|
|
id: root
|
2019-03-27 18:38:36 +01:00
|
|
|
anchors.fill: parent
|
|
|
|
color: Material.color(Material.Grey, Material.Shade800)
|
|
|
|
|
2019-06-09 12:26:11 +02:00
|
|
|
property int attStrength: 800000
|
2019-06-09 12:21:03 +02:00
|
|
|
//Emitter
|
|
|
|
property bool isEnabled: true
|
2019-06-09 12:26:11 +02:00
|
|
|
property int emitRate: 250
|
2019-06-09 12:21:03 +02:00
|
|
|
property int lifeSpan: 5000
|
|
|
|
property int size: 4
|
|
|
|
property int endSize: 8
|
|
|
|
property int sizeVariation: 4
|
|
|
|
|
|
|
|
//Image
|
|
|
|
property real imgOpacity: .75
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: ma
|
|
|
|
anchors.fill: parent
|
2020-03-06 13:25:20 +01:00
|
|
|
preventStealing: true
|
|
|
|
propagateComposedEvents:true
|
2019-06-09 12:21:03 +02:00
|
|
|
hoverEnabled: true
|
|
|
|
Component.onCompleted: {
|
|
|
|
attractor.pointX = parent.width * .5
|
2020-03-06 13:25:20 +01:00
|
|
|
attractor.pointY = parent.height * .5
|
2019-06-09 12:21:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
onPositionChanged: {
|
2019-06-09 12:26:11 +02:00
|
|
|
setPosition()
|
2020-03-06 13:25:20 +01:00
|
|
|
|
2019-06-09 12:21:03 +02:00
|
|
|
}
|
|
|
|
onClicked: {
|
2020-03-06 13:25:20 +01:00
|
|
|
// setPosition()
|
2019-06-09 12:21:03 +02:00
|
|
|
}
|
|
|
|
function setPosition() {
|
|
|
|
attractor.pointX = mouseX - 25
|
|
|
|
attractor.pointY = mouseY - 25
|
|
|
|
mouseDot.x = mouseX - mouseDot.center
|
|
|
|
mouseDot.y = mouseY - mouseDot.center
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
id: mouseDot
|
|
|
|
property int center: mouseDot.width * .5
|
|
|
|
width: 10
|
2020-03-06 13:25:20 +01:00
|
|
|
y: attractor.pointY
|
|
|
|
x: attractor.pointX
|
2019-06-09 12:21:03 +02:00
|
|
|
height: width
|
|
|
|
radius: width
|
2020-03-06 13:25:20 +01:00
|
|
|
|
2019-06-09 12:21:03 +02:00
|
|
|
color: "orange"
|
|
|
|
}
|
|
|
|
|
|
|
|
Attractor {
|
|
|
|
id: attractor
|
|
|
|
system: particleSystem
|
|
|
|
affectedParameter: Attractor.Acceleration
|
|
|
|
strength: root.attStrength
|
|
|
|
proportionalToDistance: Attractor.InverseQuadratic
|
|
|
|
}
|
|
|
|
|
|
|
|
ParticleSystem {
|
|
|
|
id: particleSystem
|
|
|
|
}
|
|
|
|
|
|
|
|
Emitter {
|
|
|
|
id: emitter
|
|
|
|
enabled: root.isEnabled
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height * .5
|
|
|
|
system: particleSystem
|
|
|
|
emitRate: root.emitRate
|
|
|
|
lifeSpan: root.lifeSpan
|
|
|
|
lifeSpanVariation: 1000
|
|
|
|
size: root.size
|
|
|
|
endSize: root.endSize
|
|
|
|
sizeVariation: root.sizeVariation
|
|
|
|
velocity: AngleDirection {
|
|
|
|
angle: -90
|
|
|
|
magnitude: 50
|
|
|
|
magnitudeVariation: 25
|
|
|
|
angleVariation: 10
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageParticle {
|
|
|
|
height: 16
|
|
|
|
width: 16
|
|
|
|
source: "dot.png"
|
|
|
|
system: particleSystem
|
|
|
|
opacity: root.imgOpacity
|
|
|
|
}
|
|
|
|
|
2020-03-06 13:25:20 +01:00
|
|
|
Text {
|
|
|
|
id: txtButtonConter
|
|
|
|
property int counter: 0
|
|
|
|
text: txtButtonConter.counter
|
|
|
|
font.pointSize: 32
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
bottom: name.top
|
|
|
|
bottomMargin: 20
|
|
|
|
}
|
|
|
|
color: "white"
|
|
|
|
}
|
2019-03-27 18:38:36 +01:00
|
|
|
Text {
|
|
|
|
id: name
|
|
|
|
text: qsTr("This is a empty test window. You can change the source in test.qml")
|
|
|
|
font.pointSize: 32
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
wrapMode: Text.WordWrap
|
2020-03-06 13:25:20 +01:00
|
|
|
anchors.centerIn: parent
|
2019-03-27 18:38:36 +01:00
|
|
|
anchors.margins: 10
|
|
|
|
color: "white"
|
|
|
|
}
|
2020-03-06 13:25:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
Row {
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
top:name.bottom
|
|
|
|
topMargin: 20
|
|
|
|
}
|
|
|
|
spacing: 20
|
|
|
|
Button {
|
|
|
|
highlighted: true
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
focus =false
|
|
|
|
focus =true
|
|
|
|
print("Button Clicked!" )
|
|
|
|
txtButtonConter.counter = txtButtonConter.counter - 1
|
|
|
|
}
|
|
|
|
text: qsTr("Click me! - 1")
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
highlighted: true
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
focus =false
|
|
|
|
focus =true
|
|
|
|
print("Button Clicked!" )
|
|
|
|
txtButtonConter.counter = txtButtonConter.counter
|
|
|
|
}
|
|
|
|
text: qsTr("Click me!")
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
highlighted: true
|
|
|
|
focusPolicy: Qt.ClickFocus
|
|
|
|
onClicked: {
|
|
|
|
|
|
|
|
print("Button Clicked!" )
|
|
|
|
txtButtonConter.counter = txtButtonConter.counter + 1
|
|
|
|
}
|
|
|
|
text: qsTr("Click me! +1")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
WebView {
|
|
|
|
width: 1000
|
|
|
|
height: 400
|
|
|
|
url: "https://screen-play.app"
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: 50
|
|
|
|
}
|
|
|
|
}
|
2019-03-27 18:38:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*##^## Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|
|
|
|
|