1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-09 20:42:47 +01:00
ScreenPlay/ScreenPlayWallpaper/qml/Test.qml

234 lines
5.3 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Particles 2.12
import QtQuick.Shapes 1.12
2021-05-13 13:57:19 +02:00
import ScreenPlayWallpaper 1.0
Rectangle {
id: root
2021-04-21 18:13:47 +02:00
2019-06-09 12:26:11 +02:00
property int attStrength: 800000
//Emitter
property bool isEnabled: true
2019-06-09 12:26:11 +02:00
property int emitRate: 250
property int lifeSpan: 5000
property int size: 4
property int endSize: 8
property int sizeVariation: 4
//Image
2021-05-16 19:37:55 +02:00
property real imgOpacity: 0.75
2021-07-15 12:07:39 +02:00
signal requestFadeIn
2021-05-16 19:37:55 +02:00
anchors.fill: parent
color: Material.color(Material.Grey, Material.Shade800)
border.width: 10
border.color: "orange"
Component.onCompleted: root.requestFadeIn()
MouseArea {
2021-05-16 19:37:55 +02:00
2021-07-15 12:07:39 +02:00
// setPosition()
id: ma
2021-05-16 19:37:55 +02:00
function setPosition() {
2021-07-15 12:07:39 +02:00
attractor.pointX = mouseX - 25
attractor.pointY = mouseY - 25
mouseDot.x = mouseX - mouseDot.center
mouseDot.y = mouseY - mouseDot.center
2021-05-16 19:37:55 +02:00
}
anchors.fill: parent
preventStealing: true
propagateComposedEvents: true
hoverEnabled: true
Component.onCompleted: {
2021-07-15 12:07:39 +02:00
attractor.pointX = parent.width * 0.5
attractor.pointY = parent.height * 0.5
}
onPositionChanged: {
2021-07-15 12:07:39 +02:00
setPosition()
}
onClicked: {
2021-07-15 12:07:39 +02:00
}
}
2021-05-16 19:37:55 +02:00
Rectangle {
id: mouseDot
2021-05-16 19:37:55 +02:00
property int center: mouseDot.width * 0.5
width: 10
height: width
radius: width
z: 99
color: "orange"
}
Attractor {
id: attractor
2021-05-16 19:37:55 +02:00
system: particleSystem
affectedParameter: Attractor.Acceleration
strength: root.attStrength
proportionalToDistance: Attractor.InverseQuadratic
}
ParticleSystem {
id: particleSystem
}
Emitter {
id: emitter
2021-05-16 19:37:55 +02:00
enabled: root.isEnabled
width: parent.width
2021-05-16 19:37:55 +02:00
height: parent.height * 0.5
system: particleSystem
emitRate: root.emitRate
lifeSpan: root.lifeSpan
lifeSpanVariation: 1000
size: root.size
endSize: root.endSize
sizeVariation: root.sizeVariation
2021-05-16 19:37:55 +02:00
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
velocity: AngleDirection {
angle: -90
magnitude: 50
magnitudeVariation: 25
angleVariation: 10
}
}
ImageParticle {
height: 16
width: 16
source: "dot.png"
system: particleSystem
opacity: root.imgOpacity
}
2021-05-16 19:37:55 +02:00
2021-04-16 10:28:45 +02:00
Text {
id: txtMousePos
2021-05-16 19:37:55 +02:00
2021-04-16 10:28:45 +02:00
property int counter: 0
2021-05-16 19:37:55 +02:00
2021-05-13 13:57:19 +02:00
text: attractor.pointY + " - " + attractor.pointX
2021-04-16 10:28:45 +02:00
font.pointSize: 32
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
2021-05-16 19:37:55 +02:00
color: "white"
2021-04-16 10:28:45 +02:00
anchors {
horizontalCenter: parent.horizontalCenter
bottom: txtButtonConter.top
bottomMargin: 20
}
}
Text {
id: txtButtonConter
2021-05-16 19:37:55 +02:00
property int counter: 0
2021-05-16 19:37:55 +02:00
text: txtButtonConter.counter
font.pointSize: 32
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
2021-05-16 19:37:55 +02:00
color: "white"
anchors {
horizontalCenter: parent.horizontalCenter
bottom: name.top
bottomMargin: 20
}
}
2021-05-16 19:37:55 +02:00
Text {
id: name
2021-05-16 19:37:55 +02:00
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
anchors.centerIn: parent
anchors.margins: 10
color: "white"
}
Row {
2021-05-16 19:37:55 +02:00
spacing: 20
anchors {
horizontalCenter: parent.horizontalCenter
top: name.bottom
topMargin: 20
}
2021-05-16 19:37:55 +02:00
Button {
highlighted: true
2021-05-16 19:37:55 +02:00
text: qsTr("Click me! - 1")
onClicked: {
2021-07-15 12:07:39 +02:00
focus = false
focus = true
print("Button Clicked!")
txtButtonConter.counter = txtButtonConter.counter - 1
}
}
2021-05-16 19:37:55 +02:00
Button {
highlighted: true
2021-05-16 19:37:55 +02:00
text: qsTr("Exit Wallpaper")
onClicked: {
2021-07-15 12:07:39 +02:00
focus = false
focus = true
print("Exit Wallpaper")
Wallpaper.terminate()
}
}
2021-05-16 19:37:55 +02:00
Button {
highlighted: true
focusPolicy: Qt.ClickFocus
2021-05-16 19:37:55 +02:00
text: qsTr("Click me! +1")
onClicked: {
2021-07-15 12:07:39 +02:00
print("Button Clicked!")
txtButtonConter.counter = txtButtonConter.counter + 1
}
}
}
2021-07-15 12:07:39 +02:00
// WebView {
// width: 1000
// height: 400
// url: "https://screen-play.app"
// anchors {
// horizontalCenter: parent.horizontalCenter
// bottom: parent.bottom
// bottomMargin: 50
// }
// }
MultimediaView {
width: 1000
height: 400
2021-05-16 19:37:55 +02:00
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 50
}
}
}