forked from yougoup/KLive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
31 lines (24 loc) · 1 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <NetWork/networkaccessmanagerfactory.h>
#include <QtQml>
#include "live.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QCoreApplication::setOrganizationName("KLive");
QCoreApplication::setOrganizationDomain("KLive");
QCoreApplication::setApplicationName("KLive");
Live live;
QQmlApplicationEngine engine;
engine.setNetworkAccessManagerFactory(new NetworkAccessManagerFactory); //开启缓存
engine.rootContext()->setContextProperty("Live",&live);
engine.rootContext()->setContextProperty("model_Ad",live.model_ad);
engine.rootContext()->setContextProperty("model_Room",live.roomModel);
engine.rootContext()->setContextProperty("model_roomItemModel",live.roomItemModel);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}