4 Star 11 Fork 5

郑永生/OctoBTT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.cpp 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
郑永生 提交于 2021-06-23 17:00 . update
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QFont>
#include <QQmlContext>
#include "./headers/userloginmodule.h"
#include "./headers/websocketmodule.h"
#include "./headers/functionmodule.h"
//#include "./headers/cameramodule.h"
//#include "./headers/viewprovider.h"
AccessControl *globalAccess = new AccessControl();
WebSocketModule *myWebsoket = new WebSocketModule;
FunctionModule *functionModule = new FunctionModule();
//ViewProvider *viewProvider = new ViewProvider();
//CameraModule *cameraModule = new CameraModule(globalAccess->MainUrl());
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QFont font;
font.setPointSize(14);
font.setFamily("qrc:/font/SimSun.ttf");
//注册模块
qmlRegisterType<UserLoginModule>("UserLoginModule",1,0,"UserLoginModule");
// qmlRegisterType<CameraModule>("MyCameraModule",1,0,"MyCameraModule");
// qmlRegisterType<UserLoginModule>("UserInfo",1,0,"UserInfo");
QGuiApplication app(argc, argv);
app.setFont(font);
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
engine.rootContext()->setContextProperty("globalAccess",globalAccess);
engine.rootContext()->setContextProperty("myWebsoket",myWebsoket);
engine.rootContext()->setContextProperty("functionModule",functionModule);
// engine.addImageProvider(QLatin1String("camera"), viewProvider);
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();
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
QML
1
https://gitee.com/Shine6Z/OctoBTT.git
git@gitee.com:Shine6Z/OctoBTT.git
Shine6Z
OctoBTT
OctoBTT
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385