Store column property to avoid repetition

This commit is contained in:
ItsDrike 2024-12-02 19:31:30 +01:00
parent 3160ad6cc4
commit c35dd9e56e
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
2 changed files with 5 additions and 2 deletions

View file

@ -98,8 +98,10 @@ ApplicationWindow {
model: gameState.columns[parent.index].length
delegate: CardModel {
required property int index
card: gameState.columns[parent.index][index].card
isFaceDown: !gameState.columns[parent.index][index].revealed
property ColumnSlot col: gameState.columns[parent.index][index]
card: col.card
isFaceDown: !col.revealed
}
}
}

View file

@ -16,6 +16,7 @@ int main(int argc, char *argv[])
Qt::QueuedConnection);
qmlRegisterUncreatableType<PlayingCard>("Solitare", 1, 0, "PlayingCard", "PlayingCard cannot be directly created in QML. Use C++ logic to instantiate.");
qmlRegisterUncreatableType<ColumnSlot>("Solitare", 1, 0, "ColumnSlot", "ColumnSlot cannot be directly created in QML. Use C++ logic to instantiate.");
GameState gameState;
gameState.dealCards();