solitare/playingcard.h

38 lines
953 B
C++

#ifndef PLAYINGCARD_H
#define PLAYINGCARD_H
#include <QObject>
class PlayingCard : public QObject
{
Q_OBJECT
Q_PROPERTY(QString color READ color WRITE setColor NOTIFY onColorChanged REQUIRED)
Q_PROPERTY(QString value READ value WRITE setValue NOTIFY onValueChanged REQUIRED)
Q_PROPERTY(bool isFaceDown READ isFaceDown WRITE setIsFaceDown NOTIFY onIsFaceDownChanged)
public:
explicit PlayingCard(const QString &color = "", const QString &value = "", bool isFaceDown = false, QObject *parent = nullptr);
QString color() const;
void setColor(const QString &color);
QString value() const;
void setValue(const QString &value);
bool isFaceDown() const;
void setIsFaceDown(bool faceDown);
signals:
void onColorChanged();
void onValueChanged();
void onIsFaceDownChanged();
private:
QString m_color;
QString m_value;
bool m_isFaceDown;
QString m_imgUrl;
};
#endif // PLAYINGCARD_H