proto-debuger/protoDebuger/main.cpp

44 lines
1.2 KiB
C++

#include <QApplication>
#include <QQmlApplicationEngine>
#include <QTextCodec>
#include <QByteArray>
#include <QtWidgets/QApplication>
#include <QQuickView>
#include <QtQuickWidgets/QQuickWidget>
#include <QQmlComponent>
#include <QQmlContext>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include "sharedata.h"
#include "serialcontroller.h"
#include "lua_wraper.h"
ShareData gGlobal;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// QQuickView view;
// view.setResizeMode(QQuickView::SizeRootObjectToView);
// view.setSource(QUrl("qrc:/main.qml"));
// view.setTitle ("多用途通信协议调试器,基于lua");
// view.rootContext()->setContextProperty("DataWrap",&gGlobal);
// view.show();
QQuickWidget *m_quickWidget=new QQuickWidget();
QUrl source("qrc:/main.qml");
m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView );
m_quickWidget->setSource(source);
m_quickWidget->rootContext()->setContextProperty("DataWrap",&gGlobal);
m_quickWidget->show();
gGlobal.SetQuickView(m_quickWidget);
return app.exec();
}