-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnavmenu.cpp
More file actions
109 lines (90 loc) · 2.76 KB
/
navmenu.cpp
File metadata and controls
109 lines (90 loc) · 2.76 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include "navmenu.h"
#include "ui_navmenu.h"
#include "login.h"
#include "salle.h"
#include "coordinateur.h"
#include "prof.h"
#include <QMessageBox>
#include <QPixmap>
NavMenu::NavMenu(QWidget *parent) :
QDialog(parent),
ui(new Ui::NavMenu)
{
ui->setupUi(this);
// LOGO
QPixmap FstLogo(":/resources/img/FST-Tanger.png");
int w1 = ui->FstLogo->width();
int h1 = ui->FstLogo->height();
ui->FstLogo->setPixmap(FstLogo.scaled(w1,h1,Qt::KeepAspectRatio));
QPixmap UniLogo(":/resources/img/UAE-Logo.png");
int w2 = ui->UniLogo->width();
int h2 = ui->UniLogo->height();
ui->UniLogo->setPixmap(UniLogo.scaled(w2,h2,Qt::KeepAspectRatio));
//database coonection
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("C:/Users/lenovo/Documents/QT/DepartmentDB.db");
if(!db.open()){
qDebug()<<"Can't connect to the database !";
}
else{
qDebug()<<"Connected !";
}
//Salle Number
QString SalleNumber;
auto qrySalle = QSqlQuery(db);
QString searchSalle = {"SELECT Salle_ID FROM Salle"};
if(!qrySalle.exec(searchSalle))
qDebug() << "Cannot select from salle";
int countSalle=0;
while(qrySalle.next())
countSalle++;
ui->SalleNumber->setText(QString::number(countSalle));
//Prof Number
QString ProfNumber;
auto qryProf = QSqlQuery(db);
QString searchProf = {"SELECT Prof_ID FROM Prof"};
if(!qryProf.exec(searchProf))
qDebug() << "Cannot select from prof";
int countProf=0;
while(qryProf.next())
countProf++;
ui->ProfNumber->setText(QString::number(countProf));
//Salle Number
QString CoordNumber;
auto qryCoord = QSqlQuery(db);
QString searchCoord = {"SELECT Coord_ID FROM Coordinateur"};
if(!qryCoord.exec(searchCoord))
qDebug() << "Cannot select from coordinateur";
int countCoord=0;
while(qryCoord.next())
countCoord++;
ui->CoordNumber->setText(QString::number(countCoord));
}
NavMenu::~NavMenu()
{
delete ui;
}
void NavMenu::on_GoSalle_clicked()
{
this->hide();
Salle Salle;
Salle.exec();
}
void NavMenu::on_GoProf_clicked()
{
this->hide();
prof prof;
prof.exec();
}
void NavMenu::on_LogoutButton_clicked()
{
this->hide();
Login Login;
Login.exec();
}
void NavMenu::on_GoCoord_clicked()
{
this->hide();
Coordinateur Coordinateur;
Coordinateur.exec();
}