-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUIMain.cpp
42 lines (33 loc) · 1012 Bytes
/
GUIMain.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
//
// Created by Misan on 5/18/2021.
//
#include <QGridLayout>
#include "GUIMain.h"
#include "gui.h"
#include "guiUser.h"
GUIMain::GUIMain(Service &serv) : _serv(serv){
this->setUpGUI();
this->connectSignalAndSlots();
}
void GUIMain::setUpGUI() {
this->adminButton = new QPushButton{"Admin"};
this->userButton = new QPushButton{"User"};
QVBoxLayout * mainLayout = new QVBoxLayout { this };
QGridLayout* buttonsLayout = new QGridLayout{};
buttonsLayout->addWidget(this->adminButton, 0, 0);
buttonsLayout->addWidget(this->userButton, 0, 1);
mainLayout->addLayout(buttonsLayout);
}
void GUIMain::connectSignalAndSlots() {
QObject::connect(this->adminButton, &QPushButton::clicked, this, &GUIMain::adminGUI);
QObject::connect(this->userButton, &QPushButton::clicked, this, &GUIMain::userGUI);
}
void GUIMain::adminGUI() {
GUIADM guiADM{this->_serv};
guiADM.show();
}
void GUIMain::userGUI() {
this->hide();
GUI gui{this->_serv};
gui.show();
}