Move FoundationPiles to it's own file

This commit is contained in:
ItsDrike 2024-12-04 19:26:16 +01:00
parent 44318ac5ac
commit bbf1cd2eaa
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
3 changed files with 18 additions and 13 deletions

View file

@ -25,6 +25,7 @@ qt_add_qml_module(appSolitare
QML_FILES Tableau.qml
QML_FILES ThrowawayPile.qml
QML_FILES DrawPile.qml
QML_FILES FoundationPiles.qml
SOURCES playingcard.h playingcard.cpp
SOURCES gamestate.h gamestate.cpp
SOURCES columnslot.h columnslot.cpp

14
FoundationPiles.qml Normal file
View file

@ -0,0 +1,14 @@
import QtQuick
Row {
spacing: 15
Repeater {
model: 4 // Each of the 4 suits
CardModel {
required property int index; // passed from repeater
card: GameState.foundation[index].length > 0 ? GameState.foundation[index][0] : null
isFaceDown: false
}
}
}

View file

@ -29,19 +29,9 @@ ApplicationWindow {
anchors.fill: parent
anchors.margins: 10
// Left row (with the foundation piles)
Row {
spacing: 15
// Left side
FoundationPiles {
anchors.left: parent.left
Repeater {
model: 4 // Each of the 4 suits
CardModel {
required property int index; // passed from repeater
card: GameState.foundation[index].length > 0 ? GameState.foundation[index][0] : null
isFaceDown: false
}
}
}
// Spacer to push the second row to the right
@ -49,7 +39,7 @@ ApplicationWindow {
Layout.fillWidth: true
}
// Right row (with throwaway and draw piles)
// Right side
Row {
spacing: 20
anchors.right: parent.right