diff --git a/protoDebuger/CMakeLists.txt b/protoDebuger/CMakeLists.txt index fba6605..d68d669 100644 --- a/protoDebuger/CMakeLists.txt +++ b/protoDebuger/CMakeLists.txt @@ -25,6 +25,7 @@ set(HEADERS # 待预编译的cpp头文件 serialcontroller.h sharedata.h network_controller.h + mainwindow.h ) @@ -35,6 +36,7 @@ set(SOURCES # 待预编译的cpp代码 lua_wraper.cpp lua_bind.cpp network_controller.cpp + mainwindow.cpp ) set(RESOURCES @@ -52,6 +54,7 @@ set (NO_MOC_SOURCES set (UIS ${QsswraperUI} + mainwindow.ui ) include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt) @@ -63,7 +66,7 @@ QT5_WRAP_UI(UIC ${UIS}) # uic生成ui_x.h FOREACH(list ${UIC}) - message("MOC " ${list} ) + message("UIC " ${list} ) ENDFOREACH(list) FOREACH(list ${MOC}) diff --git a/protoDebuger/main.cpp b/protoDebuger/main.cpp index 359fe78..4ab0a17 100644 --- a/protoDebuger/main.cpp +++ b/protoDebuger/main.cpp @@ -13,9 +13,8 @@ #include "sharedata.h" #include "serialcontroller.h" #include "lua_wraper.h" +#include "mainwindow.h" - -ShareData gGlobal; #define test1 293 int main(int argc, char *argv[]) @@ -24,13 +23,16 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - 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); + MainWindow w; + w.setWindowTitle("协议调试器"); + w.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(); } diff --git a/protoDebuger/mainwindow.cpp b/protoDebuger/mainwindow.cpp new file mode 100644 index 0000000..e18a5a1 --- /dev/null +++ b/protoDebuger/mainwindow.cpp @@ -0,0 +1,34 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "globalvar.h" +#include +#include +#include +#include +#include "sharedata.h" +#include + +ShareData gGlobal; + + +MainWindow::MainWindow(QWidget *parent) : + QssMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + 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); + + + gGlobal.SetQuickView(m_quickWidget); + ui->centralwidget->layout()->addWidget(m_quickWidget); + +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/protoDebuger/mainwindow.h b/protoDebuger/mainwindow.h new file mode 100644 index 0000000..d98fe81 --- /dev/null +++ b/protoDebuger/mainwindow.h @@ -0,0 +1,24 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include "Qss.h" + + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QssMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/protoDebuger/mainwindow.ui b/protoDebuger/mainwindow.ui new file mode 100644 index 0000000..a684504 --- /dev/null +++ b/protoDebuger/mainwindow.ui @@ -0,0 +1,55 @@ + + + MainWindow + + + + 0 + 0 + 1183 + 845 + + + + + 800 + 600 + + + + MainWindow + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + 0 + 0 + 1183 + 27 + + + + + + + + diff --git a/protoDebuger/sharedata.h b/protoDebuger/sharedata.h index 663bbe8..30da8c1 100644 --- a/protoDebuger/sharedata.h +++ b/protoDebuger/sharedata.h @@ -67,5 +67,4 @@ private: }; - #endif // SHAREDATA_H