-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
executable file
·68 lines (60 loc) · 2.32 KB
/
main.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
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
#include <QApplication>
#include <QScreen>
#include <QSurfaceFormat>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "RenderWindow.h"
#include "MainWindow.h"
#include "ModelerApp.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName("Modeler");
QCoreApplication::setOrganizationName("GhostTree");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
//QCommandLineOption multipleSampleOption("multisample", "Multisampling");
//parser.addOption(multipleSampleOption);
//QCommandLineOption coreProfileOption("coreprofile", "Use core profile");
// parser.addOption(coreProfileOption);
// QCommandLineOption transparentOption("transparent", "Transparent window");
// parser.addOption(transparentOption);
parser.process(app);
QSurfaceFormat fmt;
fmt.setStencilBufferSize(8);
fmt.setDepthBufferSize(24);
/* if (parser.isSet(multipleSampleOption)) {
fmt.setSamples(4);
}*/
//if (parser.isSet(coreProfileOption)) {
fmt.setVersion(3, 3);
fmt.setProfile(QSurfaceFormat::CoreProfile);
//}
fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
QSurfaceFormat::setDefaultFormat(fmt);
MainWindow mainWindow;
ModelerApp* modelerApp = new ModelerApp;
modelerApp->init();
MainGUI * mainGUI = mainWindow.getMainGUI();
mainGUI->setModelerApp(modelerApp);
mainGUI->setQtApp(&app);
RenderWindow * renderWindow = mainGUI->getRenderWindow();
modelerApp->setRenderWindow(renderWindow);
RenderWindow::setTransparent(false);
if (RenderWindow::isTransparent()) {
mainWindow.setAttribute(Qt::WA_TranslucentBackground);
mainWindow.setAttribute(Qt::WA_NoSystemBackground, false);
}
mainWindow.resize(mainWindow.sizeHint());
int desktopArea = QGuiApplication::primaryScreen()->availableSize().width() *
QGuiApplication::primaryScreen()->availableSize().height();
int widgetArea = mainWindow.width() * mainWindow.height();
if (((float)widgetArea / (float)desktopArea) < 0.75f)
mainWindow.show();
else
mainWindow.showMaximized();
return app.exec();
}