roulette-payout/StreetBetsView.qml

111 lines
2.6 KiB
QML
Raw Normal View History

2024-06-01 01:14:46 +01:00
import QtQuick
2024-06-01 14:46:10 +01:00
import QtQuick.Layouts
import QtQuick.Controls
2024-06-01 01:14:46 +01:00
import roulette
Item {
StreetBetsModel {
id: streetBetsModel
}
2024-06-01 14:46:10 +01:00
RowLayout {
id: layout
property int indexForDialog
2024-06-01 14:46:10 +01:00
anchors {
left: parent.left
leftMargin: 90
top: parent.top
topMargin: 22
}
2024-06-01 01:14:46 +01:00
2024-06-01 14:46:10 +01:00
spacing: 1.8
2024-06-01 01:14:46 +01:00
2024-06-01 14:46:10 +01:00
Repeater {
id: repeater
2024-06-01 14:46:10 +01:00
model: 12
2024-06-01 01:14:46 +01:00
Item {
2024-06-01 14:46:10 +01:00
height: 45
width: 35
property alias selected: selected
2024-06-01 14:46:10 +01:00
Rectangle {
visible: true
color: tapHandler1.pressed ? "#999999" : "#EEEEEE"
opacity: hoverHandler.hovered ? 0.4 : 0
height: parent.height
width: parent.width
HoverHandler {
id: hoverHandler
}
TapHandler {
id: tapHandler1
}
2024-06-01 14:46:10 +01:00
}
2024-06-01 01:14:46 +01:00
Rectangle {
id: selected
2024-06-01 01:14:46 +01:00
visible: true
color: "transparent"
height: parent.height
width: parent.width
border.color: "blue"
border.width: 0
TapHandler {
2024-06-01 01:14:46 +01:00
onTapped: {
if (parent.border.width == 0) {
parent.border.width = 2
layout.indexForDialog = index
2024-06-01 01:14:46 +01:00
dialog.open()
} else {
parent.border.width = 0
}
2024-06-01 14:46:10 +01:00
}
2024-06-01 01:14:46 +01:00
}
}
}
}
}
Dialog {
property alias input: input
id: dialog
height: 35
width: 65
TextField {
id: input
focus: true
anchors {
fill: parent
}
onActiveFocusChanged: {
selectAll()
focus = true
}
onAccepted: {
dialog.accept()
}
}
onActiveFocusChanged: {
dialog.x = 120 + repeater.itemAt(layout.indexForDialog).x
dialog.y = 60 + repeater.itemAt(layout.indexForDialog).y
}
onAccepted: PlayerAreaModel.bet(PlayerAreaModel.STREET, layout.indexForDialog, input.text)
onRejected: repeater.itemAt(layout.indexForDialog).selected.border.width = 0
}
2024-06-01 01:14:46 +01:00
}