forked from FLAME-HPC/flame_visualiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcondition.cpp
40 lines (31 loc) · 849 Bytes
/
condition.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
/*!
* \file condition.cpp
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Implementation of condition
*/
#include "./condition.h"
Condition::Condition() {
variable = "";
op = "==";
value = 0.0;
enable = false;
}
QString Condition::getString() const {
QString text;
if (!enable) return "";
text = variable;
text.append(" ");
text.append(op);
text.append(" ");
text.append(QString("%1").arg(value));
return text;
}
void Condition::paint(QPainter *painter, const QRect &rect,
const QPalette &/*palette*/, EditMode /*mode*/) const {
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
if (enable) painter->drawText(rect, Qt::AlignCenter, getString());
painter->restore();
}