diff --git a/Main.qml b/Main.qml index 7a009d9..7f9e60b 100644 --- a/Main.qml +++ b/Main.qml @@ -100,21 +100,25 @@ ApplicationWindow { Repeater { model: GameState.columns.length - // Make a column for each slot + delegate: Column { required property int index // passed from repeater spacing: -80 // Overlap Repeater { - model: GameState.columns[parent.index].length + model: GameState.columns[parent.index].length > 0 + ? GameState.columns[parent.index].length + : 1 // Render an empty slot for an empty column delegate: CardModel { required property int index - property ColumnSlot col: GameState.columns[parent.index][index] + property ColumnSlot col: GameState.columns[parent.index].length > 0 + ? GameState.columns[parent.index][index] + : null // empty column (single empty slot) - card: col.card - isFaceDown: !col.revealed + card: col ? col.card : null + isFaceDown: col ? !col.revealed : false onClicked: { - if (col.revealed) { + if (col && col.revealed) { GameState.autoMoveColumnCard(parent.index, index) } }