2024-12-04 18:15:50 +00:00
|
|
|
import QtQuick
|
2024-12-05 00:22:18 +00:00
|
|
|
import Solitare
|
2024-12-04 18:15:50 +00:00
|
|
|
|
|
|
|
// In solitare, Tableau refers to the part of the board where all of the columns are placed
|
|
|
|
Row {
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: GameState.columns.length
|
|
|
|
|
|
|
|
delegate: Column {
|
|
|
|
required property int index // passed from repeater
|
2024-12-05 02:24:09 +00:00
|
|
|
|
2024-12-04 18:15:50 +00:00
|
|
|
spacing: -80 // Overlap
|
|
|
|
|
|
|
|
Repeater {
|
2024-12-05 00:22:18 +00:00
|
|
|
model: GameState.columns[parent.index].length > 0 ? GameState.columns[parent.index].length : 1 // Render an empty slot for an empty column
|
2024-12-05 02:24:09 +00:00
|
|
|
|
2024-12-04 18:15:50 +00:00
|
|
|
delegate: CardModel {
|
|
|
|
required property int index
|
2024-12-05 00:22:18 +00:00
|
|
|
property ColumnSlot col: GameState.columns[parent.index].length > 0 ? GameState.columns[parent.index][index] : null // empty column (single empty slot)
|
2024-12-04 18:15:50 +00:00
|
|
|
|
|
|
|
card: col ? col.card : null
|
|
|
|
isFaceDown: col ? !col.revealed : false
|
|
|
|
onClicked: {
|
2024-12-05 02:24:09 +00:00
|
|
|
if (col && col.revealed)
|
2024-12-05 00:22:18 +00:00
|
|
|
GameState.autoMoveColumnCard(parent.index, index);
|
2024-12-04 18:15:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|