-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensorlistobj.cpp
More file actions
49 lines (37 loc) · 1.16 KB
/
sensorlistobj.cpp
File metadata and controls
49 lines (37 loc) · 1.16 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
#include "sensorlistobj.h"
#include <QMouseEvent>
#include <QGridLayout>
SensorListObj::SensorListObj(const QString& str,QWidget *parent):
QWidget{parent},icon(new QIcon()),iconlabel(new QLabel(this)),nome(new QLabel(str,this)),updButton(new QPushButton("mostra",this)){
setMinimumSize(150,80);
setMaximumSize(200,100);
QGridLayout* layout=new QGridLayout(this);
layout->addWidget(iconlabel,0,0);
layout->addWidget(nome,0,1);
layout->addWidget(updButton,1,0);
this->setLayout(layout);
connect(updButton,SIGNAL(clicked(bool)),this,SLOT(emissione()));
update();
}
SensorListObj::~SensorListObj(){}
void SensorListObj::setIcon(const QString& str){
icon->addFile(str);
}
QString SensorListObj::getName()const{
return nome->text();
}
void SensorListObj::setNome(const QString& str){
nome->setText(str);
update();
}
void SensorListObj::updateName(const std::string& str){
nome->setText(QString::fromStdString(str));
nome->update();
}
void SensorListObj::updateVal(const Sensor*){}
void SensorListObj::update(){
iconlabel->setPixmap(icon->pixmap(20,20));
}
void SensorListObj::emissione(){
emit click(this);
}