-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRobertWidget.cpp
More file actions
52 lines (48 loc) · 1.4 KB
/
RobertWidget.cpp
File metadata and controls
52 lines (48 loc) · 1.4 KB
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
#include "RobertWidget.h"
#include "ui_RobertWidget.h"
#include "StatusWidget.h"
#include <QDebug>
RobertWidget::RobertWidget(int robertId, QWidget *parent) :
QWidget(parent),
ui(new Ui::RobertWidget),
_robertId(robertId)
{
setFixedSize(180,240);
ui->setupUi(this);
ui->label_ID->setText(QString::number(robertId));
this->setStyleSheet("border:1px solid #000000");
}
RobertWidget::~RobertWidget()
{
delete ui;
}
void RobertWidget::mousePressEvent(QMouseEvent* event)
{
this->setStyleSheet("border:3px solid #27c927");
emit selected();
}
void RobertWidget::handleMessage(mavlink_message_t message)
{
qDebug()<<"RobertWidget::handleMessage";
switch (message.msgid) {
case MAVLINK_MSG_ID_SOLAR_CLEAN_STATUS:
{
mavlink_solar_clean_status_t status;
mavlink_msg_solar_clean_status_decode(&message,&status);
int cleaner_status = status.cleaner_status;
ui->label_Work_Status->setText(QString::number(cleaner_status));
switch(cleaner_status) {
case SOLAR_CLEAN_CLEANER_STOP:
ui->label_Work_Indicator->setStyleSheet("background-color:red");
break;
case SOLAR_CLEAN_CLEANER_RUNNING_FORWARD:
case SOLAR_CLEAN_CLEANER_RUNNING_REVERSE:
ui->label_Work_Indicator->setStyleSheet("background-color:#27c927");
break;
}
}
break;
default:
break;
}
}