From bbf1cd2eaa5e3dea3502aaa798df155ee41990c6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 4 Dec 2024 19:26:16 +0100 Subject: [PATCH] Move FoundationPiles to it's own file --- CMakeLists.txt | 1 + FoundationPiles.qml | 14 ++++++++++++++ Main.qml | 16 +++------------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 FoundationPiles.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 91e1721..7100663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/FoundationPiles.qml b/FoundationPiles.qml new file mode 100644 index 0000000..c4776cd --- /dev/null +++ b/FoundationPiles.qml @@ -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 + } + } +} diff --git a/Main.qml b/Main.qml index 52b362e..4ab8aa9 100644 --- a/Main.qml +++ b/Main.qml @@ -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