2021-01-28 17:06:40 +08:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
2021-02-02 20:42:37 +08:00
|
|
|
#include <QQmlContext>
|
2021-04-25 14:38:58 +08:00
|
|
|
#include <QMovie>
|
2021-02-02 20:42:37 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
#include "demo/DoricDemoBridge.h"
|
2021-03-04 17:44:54 +08:00
|
|
|
#include "widget/flex/FlexLayoutService.h"
|
2019-12-04 15:51:46 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2019-12-04 16:44:30 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
QGuiApplication app(argc, argv);
|
2019-12-04 15:51:46 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
QQmlApplicationEngine engine;
|
2021-03-15 15:30:17 +08:00
|
|
|
qmlRegisterType<FlexLayoutService>("pub.doric.widget", 1, 0,
|
|
|
|
"FlexLayoutService");
|
2021-03-16 15:20:46 +08:00
|
|
|
// const QUrl url(QStringLiteral("qrc:/doric/qml/test-layout.qml"));
|
2021-02-04 16:59:58 +08:00
|
|
|
const QUrl url(QStringLiteral("qrc:/main.qml"));
|
|
|
|
QObject::connect(
|
|
|
|
&engine, &QQmlApplicationEngine::objectCreated, &app,
|
|
|
|
[url](QObject *obj, const QUrl &objUrl) {
|
2021-01-28 17:06:40 +08:00
|
|
|
if (!obj && url == objUrl)
|
2021-02-04 16:59:58 +08:00
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
},
|
|
|
|
Qt::QueuedConnection);
|
2021-01-28 17:06:40 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
auto context = engine.rootContext();
|
2021-03-15 15:30:17 +08:00
|
|
|
DoricDemoBridge *demoBridge = new DoricDemoBridge();
|
2021-02-04 16:59:58 +08:00
|
|
|
context->setContextProperty("demoBridge", demoBridge);
|
2021-03-15 15:30:17 +08:00
|
|
|
|
2021-04-25 14:38:58 +08:00
|
|
|
qDebug() << QMovie::supportedFormats();
|
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
engine.load(url);
|
2021-03-04 17:44:54 +08:00
|
|
|
|
2021-02-04 16:59:58 +08:00
|
|
|
return app.exec();
|
2019-12-04 15:51:46 +08:00
|
|
|
}
|