1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-26 04:33:06 +01:00

Add browser and buttons for click testing

This commit is contained in:
Elias Steurer 2020-03-06 13:25:20 +01:00
parent c45e81dbbb
commit 7e076aa4a0

View File

@ -1,4 +1,5 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.12 import QtQuick.Particles 2.12
import QtQuick.Shapes 1.12 import QtQuick.Shapes 1.12
@ -23,19 +24,20 @@ Rectangle {
MouseArea { MouseArea {
id: ma id: ma
anchors.fill: parent anchors.fill: parent
preventStealing: true
propagateComposedEvents:true
hoverEnabled: true hoverEnabled: true
Component.onCompleted: { Component.onCompleted: {
attractor.pointX = parent.width * .5 attractor.pointX = parent.width * .5
attractor.pointY = 0 attractor.pointY = parent.height * .5
} }
onPositionChanged: { onPositionChanged: {
setPosition() setPosition()
if (ma.pressed) {
}
} }
onClicked: { onClicked: {
setPosition() // setPosition()
} }
function setPosition() { function setPosition() {
attractor.pointX = mouseX - 25 attractor.pointX = mouseX - 25
@ -48,9 +50,11 @@ Rectangle {
id: mouseDot id: mouseDot
property int center: mouseDot.width * .5 property int center: mouseDot.width * .5
width: 10 width: 10
visible: false y: attractor.pointY
x: attractor.pointX
height: width height: width
radius: width radius: width
color: "orange" color: "orange"
} }
@ -99,6 +103,21 @@ Rectangle {
opacity: root.imgOpacity opacity: root.imgOpacity
} }
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"
}
Text { Text {
id: name id: name
text: qsTr("This is a empty test window. You can change the source in test.qml") text: qsTr("This is a empty test window. You can change the source in test.qml")
@ -106,10 +125,64 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
anchors.fill: parent anchors.centerIn: parent
anchors.margins: 10 anchors.margins: 10
color: "white" color: "white"
} }
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
}
}
} }
/*##^## Designer { /*##^## Designer {