#include <QGuiApplication>
#include <QQmlApplicationEngine>

#if defined(QT_STATIC)
// needed to import statically linked plugins
#include <QtPlugin>
#include <QQuickStyle>
#include <QLoggingCategory>
//Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin);
//Q_IMPORT_PLUGIN(QQuickStylePlugin);
//Q_IMPORT_PLUGIN(QtQuickControls2Plugin);
#endif
    
int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QLoggingCategory::setFilterRules(QLatin1String("qt.quick.controls.style.debug=true"));
    Q_INIT_RESOURCE(qml);

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    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();
}
