-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.cpp
More file actions
54 lines (41 loc) · 1.54 KB
/
MainWindow.cpp
File metadata and controls
54 lines (41 loc) · 1.54 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
53
54
#include "MainWindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->menuBar->hide();
connect(ui->actionClose,SIGNAL(triggered()),this,SLOT(exitRoomControl()));
//titlebar = new Titlebar(this);
//titlebar->setParent(this);
lamp.setParent(this);
lamp.setPixmap(QPixmap(":/lamp"));
lamp.setGeometry(10,10,222,47);
lumLevel.setParent(this);
lumLevel.setPixmap(QPixmap(":/lumLevel"));
lumLevel.setGeometry(20,80,300,46);
lumProgBar = new QProgressBar(this);
lumProgBar->setGeometry(10,130,330,30);
switchButton = new SwitchButton(this,lamp.width() + 20,10);
mcuConnector = new McuConnector(this);
connect(switchButton,SIGNAL(clicked(bool)),this->mcuConnector,SLOT(setRelayState(bool)));
connect(mcuConnector,SIGNAL(relayStateChanged(bool)),switchButton,SLOT(setState(bool)));
connect(mcuConnector,SIGNAL(statusMessenger(QString,int)),ui->statusBar,SLOT(showMessage(QString,int)));
connect(mcuConnector,SIGNAL(lumLevelChanded(int)),lumProgBar,SLOT(setValue(int)));
this->setGeometry(500,250,lamp.width()+switchButton->QpixOn.width() + 30,200);
//this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
//this->setWindowFlags(Qt::Tool);
mcuConnector->startConnection();
}
MainWindow::~MainWindow()
{
delete lumProgBar;
delete switchButton;
delete mcuConnector;
delete ui;
}
void MainWindow::closeEvent(QCloseEvent *event){
//hide();
//event->ignore();
}