#include #include #include #include #include #include #include #include #include #include #include "sharedata.h" #include "serialcontroller.h" #include "lua_wraper.h" ShareData gGlobal; void RegisterQmlType(){ qmlRegisterSingletonInstance("ShareData", 1, 0, "DataWrap",&gGlobal); } int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QStringList comList; const auto infos = QSerialPortInfo::availablePorts(); for (const QSerialPortInfo &info : infos) { comList<setContextProperty("DataWrap",&gGlobal); view.show(); QObject *qmlObject = view.findChild("SerialSelect",Qt::FindChildOption::FindChildrenRecursively); qmlObject->setProperty("comlist",comList); QObject *protoDebugObj = view.findChild("ProtoDebug",Qt::FindChildOption::FindChildrenRecursively); if(nullptr != protoDebugObj){ gGlobal.SetProtoDebug(protoDebugObj); } return app.exec(); }