-
Notifications
You must be signed in to change notification settings - Fork 0
/
staffline.cpp
38 lines (32 loc) · 860 Bytes
/
staffline.cpp
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
#include "staffline.h"
#include "staffGamesConstants.h"
StaffLine::StaffLine(QRectF rect, QGraphicsItem *parent) :
QGraphicsRectItem(rect, parent), m_defaultBrush(Qt::black), m_selectedBrush(colours::highlighted),
m_correctBrush(colours::correct), m_incorrectBrush(colours::incorrect)
{
setBrush(m_defaultBrush);
}
void StaffLine::setDefaultBrush(QBrush brush)
{
m_defaultBrush = brush;
setBrush(m_defaultBrush);
}
void StaffLine::setSelected(bool selected)
{
if(selected)
setBrush(m_selectedBrush);
else
setBrush(m_defaultBrush);
QGraphicsRectItem::setSelected(selected);
}
void StaffLine::setCorrectState(bool isCorrect)
{
if(isCorrect)
setBrush(m_correctBrush);
else
setBrush(m_incorrectBrush);
}
void StaffLine::unsetCorrectState()
{
setBrush(m_defaultBrush);
}