solitare/CardModel.qml

22 lines
607 B
QML

import Solitare
import QtQuick
Item {
id: cardModel
width: 100
height: width * 1.4 // Maintian the aspect ratio of a playing card
required property PlayingCard card;
required property bool isFaceDown;
property string backStyle: "red"
Image {
id: cardImage
anchors.fill: parent
source: cardModel.isFaceDown
? "qrc:/img/playing_cards/backs/" + cardModel.backStyle + ".svg"
: "qrc:/img/playing_cards/fronts/" + cardModel.card.suitString + "_" + cardModel.card.valueString + ".svg"
fillMode: Image.PreserveAspectFit
}
}