#include #include #include #include #include "lua_wraper.h" #include #include "sharedata.h" #include "serialcontroller.h" void RegisterQmlType(){ qmlRegisterType("ShareData", 1, 0, "Data"); } int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); // TestLua(); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); SerialController *pSerial = new SerialController(); QList list = pSerial->GetPorts(); for(int i = 0 ;i < list.size();i++){ QTextCodec *codec = QTextCodec::codecForName("UTF-16"); QString string = codec->fromUnicode(list[i].portName.toUtf8()); qDebug()<