-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplayer.h
53 lines (35 loc) · 1.03 KB
/
player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include <QColor>
class Player : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(int score READ score WRITE setScore NOTIFY scoreChanged)
Q_PROPERTY(int key READ key WRITE setKey NOTIFY keyChanged)
public:
explicit Player(QObject * parent = nullptr);
explicit Player(QString const& name, QColor const& color, QObject * parent = nullptr);
QString name() const;
QColor color() const;
int score() const;
int key() const;
public slots:
void setName(QString name);
void setColor(QColor color);
void setScore(int score);
void setKey(int key);
signals:
void nameChanged(QString name);
void colorChanged(QColor color);
void scoreChanged(int score);
void keyChanged(int key);
private:
QString m_name;
QColor m_color;
int m_score = 0;
int m_key = 0;
};
#endif // PLAYER_H