-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstickylinesignalhandler.cpp
65 lines (48 loc) · 1.54 KB
/
stickylinesignalhandler.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
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
#include "stickylinesignalhandler.h"
#include <QDebug>
StickyLineSignalHandler::StickyLineSignalHandler(QObject *parent) :
QObject(parent), m_line(nullptr)
{
m_lineColourTimer = new QTimer(this);
m_lineColourTimer->setInterval(1000);
m_lineColourTimer->setSingleShot(true);
connect(m_lineColourTimer, SIGNAL(timeout()), SLOT(resetLineColour()));
}
void StickyLineSignalHandler::setLine(StickyLine* line)
{
//qDebug() << "SETLINE address for line " << line->data(objectPropertyKeys::name).toString() << ": " << line;
//m_line = nullptr;
m_line = line;
}
void StickyLineSignalHandler::test()
{
qDebug() << "test" << m_lineName;
}
void StickyLineSignalHandler::userResult(bool isCorrect)
{
//qDebug() << "SETLINE address for line : " << m_line;
//m_line->data(objectPropertyKeys::type);
//m_line->setColour(colours::correct);
m_lineColourTimer->start();
if(isCorrect){
m_line->setHighlight(colours::correct);
m_lineColourTimer->start();
}
else{
m_line->setHighlight(colours::incorrect);
m_lineColourTimer->start();
}
}
void StickyLineSignalHandler::resetLineColour()
{
QString type = m_line->data(objectPropertyKeys::type).toString();
qDebug() << m_line->data(objectPropertyKeys::name).toString();
if(type == objectPropertyTypes::lineType){
//m_line->setColour(Qt::black);
m_line->setHighlight(colours::highlighted);
}
else{
qDebug() << "Colour reset";
m_line->setHighlight(colours::highlighted);
}
}