Add broken Qt sample

This commit is contained in:
Caelan Sayler
2024-10-20 00:59:36 +01:00
committed by Caelan
parent c73811033e
commit 1de333c616
10 changed files with 585 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "autoupdater.h"
int main(int argc, char *argv[]) {
try {
// Init Velopack hooks, MUST be as early as possible in main()
// Velopack may exit / restart our app at this statement
Velopack::startup(argv, argc);
} catch (const std::exception &err) {
qInfo() << "Error initating auto-updater, msg: " << err.what();
}
QGuiApplication app(argc, argv);
// Init Auto Updater as a singleton
qmlRegisterSingletonInstance("VelopackQt", 1, 0, "AutoUpdater",
&AutoUpdater::instance());
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/VelopackQtSample/Main.qml"_qs);
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreated, &app,
[url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}