main.cpp Example File
planets-qml/main.cpp
#include <QGuiApplication>
#include <QQuickView>
#include <QQmlContext>
#include <QOpenGLContext>
#include "networkcontroller.h"
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QSurfaceFormat format;
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
}
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSamples(4);
NetworkController networkController;
QQuickView view;
view.setFormat(format);
view.rootContext()->setContextProperty("networkController", &networkController);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/PlanetsMain.qml"));
view.setColor("#000000");
view.show();
return app.exec();
}