-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontroller.cpp
More file actions
41 lines (35 loc) · 1011 Bytes
/
controller.cpp
File metadata and controls
41 lines (35 loc) · 1011 Bytes
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
#include <QLabel>
#include <QGridLayout>
#include <QTimer>
#include <QGroupBox>
#include "controller.h"
#include "led.h"
Controller::Controller(QString name, QWidget *parent)
: QWidget{parent}
{
this->setFixedHeight(128);
loOutline = new QGridLayout;
loOutline->setContentsMargins(0,0,0,0);
gbOutline = new QGroupBox;
loMain = new QGridLayout;
loMain->setContentsMargins(8,8,8,8);
laName = new QLabel(name);
indicator = new Led;
loMain->addWidget(laName,0,0,Qt::AlignCenter);
loMain->addWidget(indicator,1,0,Qt::AlignCenter);
gbOutline->setLayout(loMain);
loOutline->addWidget(gbOutline);
this->setLayout(loOutline);
flashTimer.setSingleShot(true);
flashTimer.setInterval(flashingIntervalMs);
connect(&flashTimer, &QTimer::timeout, this, &Controller::flashIndicatorTo);
}
void Controller::flashIndicator()
{
indicator->setState(true);
flashTimer.start();
}
void Controller::flashIndicatorTo()
{
indicator->setState(false);
}