Convinient use of repeaters.
This commit is contained in:
parent
5cdc225e47
commit
8b3815baac
3 changed files with 70 additions and 73 deletions
|
@ -3,7 +3,7 @@
|
|||
PlayerAreaModel::PlayerAreaModel(QObject *parent)
|
||||
{
|
||||
for(int i = 0; i < 7; i++){
|
||||
playerNames.append("Click to edit");
|
||||
playerNames.append("N/A");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,37 +5,36 @@ import QtQuick.Layouts
|
|||
import roulette
|
||||
|
||||
Item {
|
||||
ColumnLayout {
|
||||
Text {
|
||||
id: croupier
|
||||
text: "Croupier"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
top: croupier.bottom
|
||||
topMargin: 20
|
||||
}
|
||||
|
||||
spacing: 60
|
||||
|
||||
Repeater {
|
||||
model: 7
|
||||
|
||||
Item {
|
||||
Text {
|
||||
id: label
|
||||
text: "Player " + (index + 1)
|
||||
}
|
||||
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 0)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(0)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 1)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(1)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 2)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(2)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 3)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(3)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 4)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(4)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 5)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(5)
|
||||
}
|
||||
TextField {
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, 6)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(6)
|
||||
anchors.top: label.bottom
|
||||
anchors.topMargin: 6
|
||||
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, index)
|
||||
onActiveFocusChanged: PlayerAreaModel.setFocusedPlayer(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import roulette
|
||||
|
||||
|
@ -8,6 +9,16 @@ Item {
|
|||
id: streetBetsModel
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 90
|
||||
top: parent.top
|
||||
topMargin: 22
|
||||
}
|
||||
|
||||
spacing: 1.8
|
||||
|
||||
Repeater {
|
||||
model: 12
|
||||
|
||||
|
@ -18,13 +29,6 @@ Item {
|
|||
height: 45
|
||||
width: 35
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 90 + (index * (width + 1.8))
|
||||
top: parent.top
|
||||
topMargin: 22
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
}
|
||||
|
@ -45,13 +49,6 @@ Item {
|
|||
border.color: "blue"
|
||||
border.width: 0
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 90 + (index * (width + 1.8))
|
||||
top: parent.top
|
||||
topMargin: 22
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
|
||||
onTapped: ()=> {
|
||||
|
@ -66,3 +63,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue