Store column property to avoid repetition
This commit is contained in:
parent
3160ad6cc4
commit
c35dd9e56e
6
Main.qml
6
Main.qml
|
@ -98,8 +98,10 @@ ApplicationWindow {
|
||||||
model: gameState.columns[parent.index].length
|
model: gameState.columns[parent.index].length
|
||||||
delegate: CardModel {
|
delegate: CardModel {
|
||||||
required property int index
|
required property int index
|
||||||
card: gameState.columns[parent.index][index].card
|
property ColumnSlot col: gameState.columns[parent.index][index]
|
||||||
isFaceDown: !gameState.columns[parent.index][index].revealed
|
|
||||||
|
card: col.card
|
||||||
|
isFaceDown: !col.revealed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
main.cpp
1
main.cpp
|
@ -16,6 +16,7 @@ int main(int argc, char *argv[])
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
qmlRegisterUncreatableType<PlayingCard>("Solitare", 1, 0, "PlayingCard", "PlayingCard cannot be directly created in QML. Use C++ logic to instantiate.");
|
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 gameState;
|
||||||
gameState.dealCards();
|
gameState.dealCards();
|
||||||
|
|
Loading…
Reference in a new issue