no message

master
zcy 2021-07-13 00:38:29 +08:00
parent e0db9e869e
commit 65fa443745
6 changed files with 128 additions and 11 deletions

View File

@ -25,6 +25,7 @@ set(HEADERS # 待预编译的cpp头文件
serialcontroller.h serialcontroller.h
sharedata.h sharedata.h
network_controller.h network_controller.h
mainwindow.h
) )
@ -35,6 +36,7 @@ set(SOURCES # 待预编译的cpp代码
lua_wraper.cpp lua_wraper.cpp
lua_bind.cpp lua_bind.cpp
network_controller.cpp network_controller.cpp
mainwindow.cpp
) )
set(RESOURCES set(RESOURCES
@ -52,6 +54,7 @@ set (NO_MOC_SOURCES
set (UIS set (UIS
${QsswraperUI} ${QsswraperUI}
mainwindow.ui
) )
include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt) include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt)
@ -63,7 +66,7 @@ QT5_WRAP_UI(UIC ${UIS}) # uic生成ui_x.h
FOREACH(list ${UIC}) FOREACH(list ${UIC})
message("MOC " ${list} ) message("UIC " ${list} )
ENDFOREACH(list) ENDFOREACH(list)
FOREACH(list ${MOC}) FOREACH(list ${MOC})

View File

@ -13,9 +13,8 @@
#include "sharedata.h" #include "sharedata.h"
#include "serialcontroller.h" #include "serialcontroller.h"
#include "lua_wraper.h" #include "lua_wraper.h"
#include "mainwindow.h"
ShareData gGlobal;
#define test1 293 #define test1 293
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -24,13 +23,16 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QQuickWidget *m_quickWidget=new QQuickWidget(); MainWindow w;
QUrl source("qrc:/main.qml"); w.setWindowTitle("协议调试器");
m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView ); w.show();
m_quickWidget->setSource(source); // QQuickWidget *m_quickWidget=new QQuickWidget();
m_quickWidget->rootContext()->setContextProperty("DataWrap",&gGlobal); // QUrl source("qrc:/main.qml");
m_quickWidget->show(); // m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView );
gGlobal.SetQuickView(m_quickWidget); // m_quickWidget->setSource(source);
// m_quickWidget->rootContext()->setContextProperty("DataWrap",&gGlobal);
// m_quickWidget->show();
// gGlobal.SetQuickView(m_quickWidget);
return app.exec(); return app.exec();
} }

View File

@ -0,0 +1,34 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "globalvar.h"
#include <QQuickView>
#include <QtQuickWidgets/QQuickWidget>
#include <QQmlComponent>
#include <QQmlContext>
#include "sharedata.h"
#include <QLayout>
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;
}

24
protoDebuger/mainwindow.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#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

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1183</width>
<height>845</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1183</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -67,5 +67,4 @@ private:
}; };
#endif // SHAREDATA_H #endif // SHAREDATA_H