OGS
main.cpp
Go to the documentation of this file.
1#include <QVTKOpenGLNativeWidget.h>
2#include <vtkSmartPointer.h>
3
4#include <QApplication>
5#include <QSurfaceFormat>
6#include <memory>
7
8#include "InfoLib/GitInfo.h"
10#include "mainwindow.h"
11
12// TODO: Replace this on VTK 9 upgrade, see
13// https://discourse.vtk.org/t/vtk-use-file/3645/2
14#if VTK_VIA_CPM
15#include <vtkAutoInit.h>
16VTK_MODULE_INIT(vtkInteractionStyle)
17VTK_MODULE_INIT(vtkRenderingFreeType)
18VTK_MODULE_INIT(vtkRenderingOpenGL2)
19#endif
20
21int main(int argc, char* argv[])
22{
23 // needed to ensure appropriate OpenGL context is created for VTK rendering.
24 QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
25
26 auto myOutputWindow = vtkSmartPointer<VtkConsoleOutputWindow>::New();
27 vtkOutputWindow::SetInstance(myOutputWindow);
28
29 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
30 QApplication a(argc, argv);
31 QApplication::setApplicationName("OpenGeoSys - Data Explorer");
32 QApplication::setApplicationVersion(
33 QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
34 QApplication::setOrganizationName("OpenGeoSys Community");
35 QApplication::setOrganizationDomain("opengeosys.org");
36 setlocale(LC_NUMERIC, "C");
37 QLocale::setDefault(QLocale::German);
38 auto w = std::make_unique<MainWindow>();
39 w->setWindowTitle(w->windowTitle() + " - " +
40 QString::fromStdString(GitInfoLib::GitInfo::ogs_version));
41 if (QCoreApplication::arguments().size() > 1)
42 {
43 w->loadFileOnStartUp(QCoreApplication::arguments().at(1));
44 }
45 w->show();
46 int returncode = QApplication::exec();
47
48 return returncode;
49}
int main(int argc, char *argv[])
Definition main.cpp:21
Git information.
VtkWin32ConsoleOutputWindow is used to suppress message boxes on Windows.
GITINFOLIB_EXPORT const std::string ogs_version