2024-06-02 21:13:43 +01:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
|
|
|
import roulette
|
|
|
|
|
|
|
|
Dialog {
|
2024-06-04 21:10:39 +01:00
|
|
|
required property int betType /* It wouldn't accept the BetType type defined in PlayerAreaModel so I just used the int since that's what it is*/
|
2024-06-02 21:13:43 +01:00
|
|
|
required property int n
|
|
|
|
required property int squareX
|
|
|
|
required property int squareY
|
|
|
|
|
|
|
|
id: dialog
|
|
|
|
modal: true
|
|
|
|
height: 35
|
|
|
|
width: 80
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: input
|
|
|
|
focus: true
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: gil.left
|
|
|
|
rightMargin: 5
|
|
|
|
top: parent.top
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
|
|
|
|
onActiveFocusChanged: {
|
|
|
|
selectAll()
|
|
|
|
focus = true
|
|
|
|
}
|
|
|
|
onAccepted: {
|
|
|
|
dialog.accept()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: gil
|
|
|
|
text: "g"
|
|
|
|
|
|
|
|
anchors {
|
2024-06-04 21:10:39 +01:00
|
|
|
/* Can not 'left: indicator.right'; Only anchor the same side once, which was done in 'input' */
|
2024-06-02 21:13:43 +01:00
|
|
|
right: parent.right
|
|
|
|
verticalCenter: input.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onActiveFocusChanged: {
|
2024-06-04 22:14:26 +01:00
|
|
|
dialog.x = squareX
|
|
|
|
dialog.y = squareY
|
2024-06-02 21:13:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
onAccepted: {
|
2024-06-05 23:10:06 +01:00
|
|
|
/*
|
|
|
|
* Qt has no good way of making bottom to top grid layouts, so I had to use
|
|
|
|
* a workaround where the indexes do not work as expected.
|
|
|
|
*
|
|
|
|
* A solution for the indexes is to rotate the layout 180º, but that will mess up
|
|
|
|
* the x and y coordinates which is even more annoying to fix.
|
|
|
|
*/
|
|
|
|
//if (betType == 9 && n < 35) {
|
|
|
|
// n = 35 - n
|
|
|
|
//}
|
2024-06-02 21:13:43 +01:00
|
|
|
PlayerAreaModel.bet(betType, n, input.text)
|
|
|
|
rouletteTable.numberOfBets += 1
|
|
|
|
}
|
|
|
|
|
|
|
|
onRejected: {
|
2024-06-04 21:10:39 +01:00
|
|
|
PlayerAreaModel.cancelBet(betType, n)
|
2024-06-02 21:13:43 +01:00
|
|
|
}
|
|
|
|
}
|