123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <QGuiApplication>
- #include <QObject>
- #include <QQmlApplicationEngine>
- #include <QQmlComponent>
- #include <QQmlContext>
- #include <csignal>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <sys/prctl.h>
- #include <sys/wait.h>
- #include <thread>
- #include <unistd.h>
- #include "qmlhandler.h"
- using namespace std;
- int main(int argc, char *argv[]) {
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- // This has to be here to fix warnings
- QCoreApplication::setOrganizationName("CCats");
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- QMLHandler qmlHandler;
- // Set the context for the window, so that the qml files can be connected to
- // the qmlHandler
- engine.rootContext()->setContextProperty("_qmlHandler", &qmlHandler);
- // Load the main window
- QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/main.qml")));
- QObject *object = component.create();
- // Run the main window and save the return of the application in an integer
- // ret This is blocking, which means it will block the main program until the
- // window is closed
- int ret = app.exec();
- // If we land here, the window has been closed. Properly disconnect from the
- // server now
- qmlHandler.onExit();
- return ret;
- }
|