Newer
Older
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
78
#include "SlugsPIDControl.h"
#include "ui_SlugsPIDControl.h"
#include <QPalette>
#include<QColor>
#include <QDebug>
SlugsPIDControl::SlugsPIDControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsPIDControl)
{
ui->setupUi(this);
//connectButtons();
//this call functions is only an example to view the color in the groupBox
changeRedColor(ui->AirSpeedHold_groupBox);
changeGreenColor(ui->HeightErrorLoPitch_groupBox);
}
SlugsPIDControl::~SlugsPIDControl()
{
delete ui;
}
/**
* Set the background color RED of the GroupBox PID based on the send Slugs PID message
*
*/
void SlugsPIDControl::changeRedColor(QGroupBox *group)
{
// GroupBox Color
QColor groupColor = QColor(231,72,28);
QString colorstyle;
QString borderColor = "#FA4A4F"; //"#4A4A4F";
groupColor = groupColor.darker(475);
colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }",
groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str());
group->setStyleSheet(colorstyle);
}
/**
* Set the background color GREEN of the GroupBox PID based on the send Slugs PID message
*
*/
void SlugsPIDControl::changeGreenColor(QGroupBox *group)
{
// GroupBox Color
QColor groupColor = QColor(30,124,16);
QString colorstyle;
QString borderColor = "#24AC23";
groupColor = groupColor.darker(475);
colorstyle = colorstyle.sprintf("QGroupBox {background-color: #%02X%02X%02X; border: 5px solid %s; }",
groupColor.red(), groupColor.green(), groupColor.blue(), borderColor.toStdString().c_str());
group->setStyleSheet(colorstyle);
}
/**
* Connection Signal and Slot of the set and get buttons on the widget
*
*/
void SlugsPIDControl::connectButtons()
{
//ToDo connect buttons set and get. Before create the slots
}