-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (33 loc) · 1.47 KB
/
Copy pathmain.cpp
File metadata and controls
40 lines (33 loc) · 1.47 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
/* Author: Soumitra Goswami
// Date: 5/01/2018
// Description: This is a C++ and QT5 program that simulates a Lagrangian Smooth Particle Hydrodynamics (SPH) simulation
// Main.cpp is the entry point to the QT widget.
// Main.cpp -> sphsimulation.h (QT Widget) -> solver.h (Our actual simulation code)
//
// QT works in having signals and slots. "Signals" send out info as messages and slots recieve them.
// For all the setup of signals and slots check mainwindow.hpp and generation and setup of functionality of UI.
// The actual visual generation of UI is done via QT Designer.
//
*/
#include "mainwindow.hpp"
#include "sphsimulation.h"
#include <QtWidgets/QApplication>
#include <QMainWindow>
/* Brief Overview of workflow with QT5
-> A window is generated (mainwindow.h) which contains my UI buttons and an OpenGLWidget.
-> This OpenGLWidget is connected to "sphsimulation.h" which contains SLOTS to listen to SIGNALS sent by "mainwindow.h"
-> "sphsimulation.h" then transfers these incoming SIGNALS to solver.h which contains the bulk of our simulation code.
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
format.setVersion(2, 1);
SPHSimulation *widget = new SPHSimulation;
widget->setFormat(format);
Mainwindow w;
w.show();
return a.exec();
}