/****************************************************************** Copyright © Deng Zhimao Co., Ltd. 1990-2030. All rights reserved. * @projectName QDesktop * @brief main.cpp * @author Deng Zhimao * @email 1252699831@qq.com * @date 2020-07-31 *******************************************************************/ #include #include #include "desktop/desktop.h" #include "weather/weatherdata.h" #include "weather/mymodel.h" #include #include #include "music/lyricmodel.h" #include "music/playlistmodel.h" #include "media/mediaListModel.h" #include "wireless/wirelessmodel.h" #include "tcpclient/mytcpclient.h" #include "tcpserver/mytcpserver.h" #include "udpchat/udpreciver.h" #include "udpchat/udpsender.h" #include "photoview/photolistmodel.h" #include "iotest/beep.h" #include "sensor/ap3216c.h" #include "sensor/icm20608.h" #include "radio/radio.h" #include "fileview/fileio.h" #include "aflex/adc.h" #include "aflex/dac.h" #include #include int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //QGuiApplication app(argc, argv); QApplication app(argc, argv); QDir::setCurrent(QCoreApplication::applicationDirPath()); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); qmlRegisterType("an.weather", 1, 0, "IndexData"); qmlRegisterType("an.weather", 1, 0, "WeatherData"); qmlRegisterType("an.model", 1, 0, "MyModel"); qmlRegisterType("dataModel", 1, 0, "LyricModel"); qmlRegisterType("dataModel", 1, 0, "PlayListModel"); qmlRegisterType("mediaModel", 1, 0, "MediaListModel"); qmlRegisterType("wirelessModel", 1, 0, "WirelessListModel"); qmlRegisterType("mytcpclient", 1, 0, "MyTcpclient"); qmlRegisterType("mytcpserver", 1, 0, "MyTcpserver"); qmlRegisterType("udpsender", 1, 0, "UdpSender"); qmlRegisterType("udpreciver", 1, 0, "UdpReciver"); qmlRegisterType("beep", 1, 0, "Beep"); qmlRegisterType("ap3216c", 1, 0, "Ap3216c"); qmlRegisterType("icm20608", 1, 0, "Icm20608"); qmlRegisterType("radio", 1, 0, "MyRadio"); qmlRegisterType("myDesktop", 1, 0, "MyDesktop"); qmlRegisterType("fileIO", 1, 0, "FileIO"); qmlRegisterType("adc", 1, 0, "Adc"); qmlRegisterType("dac", 1, 0, "Dac"); QQmlApplicationEngine engine; #if WIN32 engine.rootContext()->setContextProperty("WINenv", true); #else engine.rootContext()->setContextProperty("WINenv", false); #endif engine.rootContext()->setContextProperty("WINStyle", true); engine.rootContext()->setContextProperty("appCurrtentDir", QCoreApplication::applicationDirPath()); MyModel *myModel = new MyModel(); MyDesktop *myDesktop = new MyDesktop(); photoListModel *myPhoto = new photoListModel(); engine.rootContext()->setContextProperty("myPhoto", myPhoto); engine.rootContext()->setContextProperty("myModel", myModel); engine.rootContext()->setContextProperty("myDesktop", myDesktop); myPhoto->add(QCoreApplication::applicationDirPath() + "/src/images/"); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }