-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlwindow.cpp
43 lines (37 loc) · 1.27 KB
/
controlwindow.cpp
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
#include "controlwindow.h"
TControlWindow::TControlWindow(bool m, QWidget *parent) :
QWidget(parent)
{
setAttribute(Qt::WA_DeleteOnClose,true);
setFixedSize(200,130);
setWindowTitle("Управление");
setEnabled(m);
clearQueue_btn = new QPushButton("Очистить очередь",this);
clearQueue_btn->setGeometry(10,10,180,20);
connect(clearQueue_btn,SIGNAL(pressed()),this,SIGNAL(clear()));
singleCar_btn = new QPushButton("Приезд машины",this);
singleCar_btn->setGeometry(10,40,180,20);
connect(singleCar_btn,SIGNAL(pressed()),this,SIGNAL(single()));
autoSupply = new QPushButton("Приезд машины автомат.",this);
autoSupply->setGeometry(10,70,180,20);
connect(autoSupply,SIGNAL(pressed()),this,SLOT(switchMode()));
}
TControlWindow::~TControlWindow()
{
delete autoSupply;
delete singleCar_btn;
delete clearQueue_btn;
}
void TControlWindow::closeEvent(QCloseEvent* event)
{
emit closing();
event->accept();
}
void TControlWindow::switchMode()
{
bool m = !clearQueue_btn->isEnabled();
clearQueue_btn->setEnabled(m);
singleCar_btn->setEnabled(m);
autoSupply->setText(m?"Автоматический режим":"Ручной режим");
emit mode(!m);
}