roulette-payout/Root.qml
2024-06-09 13:25:58 +01:00

106 lines
2.7 KiB
QML

import QtQuick
import QtQuick.Controls
import roulette /* this is importing the target "roulette-payout" defined in CMakeLists.txt */
Window {
maximumHeight: 500
maximumWidth: 1000
minimumHeight: 500
minimumWidth: 1000
title: "Roulette Payout"
visible: true
Pane {
anchors.fill: parent
/* Exists exclusively to remove focus from TextFields by clicking anywhere else on the screen */
MouseArea {
anchors.fill: parent
onClicked: focus = true
}
PlayerAreaView {
id: playerAreaView
}
Roulette {
id: roulette
height: parent.height / 1.7
width: parent.width / 1.7
anchors{
top: parent.top
right: parent.right
}
}
Button {
id: payoutButton
onClicked: PlayerAreaModel.payout()
enabled: false
anchors {
left: roulette.left
bottom: parent.bottom
bottomMargin: 20
}
contentItem: Text {
text: "Payout"
font.pointSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: {
if (enabled == true) {
"#000000"
} else {
"#555555"
}
}
}
background: Rectangle {
implicitWidth: 150
implicitHeight: 60
opacity: {
if (enabled == true && parent.pressed) {
0.5
} else if (enabled == true && parent.hovered) {
0.2
} else {
0.3
}
}
color: {
if (enabled == true) {
"#AAAAAA"
} else {
"#444444"
}
}
border.width: 0
}
Connections {
target: PlayerAreaModel
function onBetChanged() {
if (PlayerAreaModel.focusedPlayer == 0) {
payoutButton.enabled = true;
}
}
function onBetRemoved() {
if (PlayerAreaModel.focusedPlayer == 0) {
payoutButton.enabled = false;
}
}
}
}
Results {
}
}
}