solitare/playingcard.cpp

48 lines
855 B
C++
Raw Normal View History

2024-12-01 18:43:49 +00:00
#include "playingcard.h"
PlayingCard::PlayingCard(const QString &color, const QString &value, bool isFaceDown, QObject *parent)
: QObject{parent}, m_color{color}, m_value{value}, m_isFaceDown{isFaceDown}
{ }
QString PlayingCard::color() const
{
return m_color;
}
void PlayingCard::setColor(const QString &color)
{
if (m_color == color)
return;
m_color = color;
emit onColorChanged();
}
QString PlayingCard::value() const
{
return m_value;
}
void PlayingCard::setValue(const QString &value)
{
if (m_value == value)
return;
m_value = value;
emit onValueChanged();
}
bool PlayingCard::isFaceDown() const
{
return m_isFaceDown;
}
void PlayingCard::setIsFaceDown(bool faceDown)
{
if (m_isFaceDown == faceDown)
return;
m_isFaceDown = faceDown;
emit onIsFaceDownChanged();
}