forked from tobyp/queopardy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion.h
More file actions
77 lines (49 loc) · 1.8 KB
/
question.h
File metadata and controls
77 lines (49 loc) · 1.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef QUESTION_H
#define QUESTION_H
#include <QObject>
#include "playeranswer.h"
class Question : public QObject
{
Q_OBJECT
Q_PROPERTY(QString question READ question WRITE setQuestion NOTIFY questionChanged)
Q_PROPERTY(int points READ points WRITE setPoints NOTIFY pointsChanged)
Q_PROPERTY(bool revealed READ revealed WRITE setRevealed NOTIFY revealedChanged)
Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(QList<QObject*> playerAnswers READ playerAnswers WRITE setPlayerAnswers NOTIFY playerAnswersChanged)
public:
explicit Question(QObject *parent = nullptr);
explicit Question(int points, QString const& question, QObject *parent = nullptr);
QString question() const;
int points() const;
bool revealed() const;
QString font() const;
int fontSize() const;
QList<QObject*> playerAnswers() const;
signals:
void questionChanged(QString question);
void pointsChanged(int points);
void revealedChanged(bool revealed);
void fontChanged(QString font);
void fontSizeChanged(int fontSize);
void playerAnswersChanged(QList<QObject*> playerAnswers);
void questionStateChanged();
public slots:
void setQuestion(QString question);
void setPoints(int points);
void setRevealed(bool revealed);
void setFont(QString font);
void setFontSize(int fontSize);
void setPlayerAnswers(QList<QObject*> playerAnswers);
void addPlayerAnswer(QObject * player, int score);
void playerAnswerStateChanged();
private:
int m_points;
QString m_question;
bool m_revealed;
QString m_font;
int m_fontSize;
QList<QObject*> m_playerAnswers;
QObject * m_winner;
};
#endif // QUESTION_H