-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
53 lines (40 loc) · 1.41 KB
/
main.cpp
File metadata and controls
53 lines (40 loc) · 1.41 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
#include <QApplication>
#include <QTranslator>
#include <QMessageBox>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(false);
MainWindow researcherWindow, operatorWindow;
researcherWindow.setFixedSize(QSize(1015, 580));
operatorWindow.setFixedSize(QSize(1015, 580));
QTranslator myTranslator;
myTranslator.load(QLocale::system(), "SA", "_", QApplication::applicationDirPath());
a.installTranslator(&myTranslator);
QMessageBox whoIsHe;
whoIsHe.setWindowTitle(QString("%1").arg(QMessageBox::tr("Crossroads")));
whoIsHe.setFixedSize(QSize(250, 100));
whoIsHe.setText(QString(QMessageBox::tr("Who are you, Dartanyan or a true European?")));
QPushButton *researcherButton = whoIsHe.addButton(QMessageBox::tr("Dartanyan"), QMessageBox::ActionRole);
QPushButton *operatorButton = whoIsHe.addButton(QMessageBox::tr("True European"), QMessageBox::ActionRole);
whoIsHe.setDefaultButton(operatorButton);
whoIsHe.exec();
if(whoIsHe.clickedButton() == operatorButton)
{
operatorWindow.show();
qApp->exit();
whoIsHe.close();
}
else
{
if(whoIsHe.clickedButton() == researcherButton)
{
researcherWindow.show();
qApp->exit();
whoIsHe.close();
}
}
a.setQuitOnLastWindowClosed(true);
return a.exec();
}