no message

master
zcy 2021-04-05 02:32:21 +08:00
parent 02f19026e7
commit 0a5032e239
6 changed files with 202 additions and 29 deletions

View File

@ -1,44 +1,82 @@
cmake_minimum_required(VERSION 3.5)
project(protoDebuger LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC FALSE)
set(CMAKE_AUTOMOC FALSE)
set(CMAKE_AUTORCC FALSE)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.
include_directories(third/lua/include)
link_directories(third/lua/lib)
link_libraries(lua)
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED)
find_package(Qt5 COMPONENTS Core Quick REQUIRED)
#include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt)
if(ANDROID)
add_library(protoDebuger SHARED
main.cpp
qml.qrc
)
else()
add_executable(protoDebuger
main.cpp
qml.qrc
)
endif()
set(SOURCES # 待预编译的cpp代码
dialog.cpp
main.cpp
)
set(HEADERS # 待预编译的cpp头文件
dialog.h
)
set(RESOURCES
qml.qrc
)
set(QMLS
main.qml
)
set (UIS
"dialog.ui"
${QsswraperUI}
)
QT5_WRAP_CPP(MOC ${SOURCES} ) # moc
QT5_ADD_RESOURCES(RCC ${RESOURCES}) # rcccpp
QT5_WRAP_UI(UIC ${UIS}) # uicui_x.h
FOREACH(list ${MOCHEADER})
message("MOCHEADER file " ${list})
ENDFOREACH(list)
FOREACH(list ${MOC})
message("MOC file " ${list})
ENDFOREACH(list)
FOREACH(list ${SOURCES})
message("SOURCES file " ${list})
ENDFOREACH(list)
FOREACH(list ${UIC})
message("UIC file " ${list})
ENDFOREACH(list)
FOREACH(list ${RCC})
message("RCC file " ${list})
ENDFOREACH(list)
add_executable(protoDebuger #最后需要参与链接生成的是
${SOURCES} #1. cpp
${MOC} #2. cpp
${RCC} #3. cpp
)
target_compile_definitions(protoDebuger
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(protoDebuger
PRIVATE Qt5::Core Qt5::Quick)
PRIVATE Qt5::Core Qt5::Quick Qt5::Widgets) # QTqmake .pro QT+= XXX

14
protoDebuger/dialog.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
}
Dialog::~Dialog()
{
delete ui;
}

22
protoDebuger/dialog.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = nullptr);
~Dialog();
private:
Ui::Dialog *ui;
};
#endif // DIALOG_H

71
protoDebuger/dialog.ui Normal file
View File

@ -0,0 +1,71 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>Dialog</class>
<widget name="Dialog" class="QDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget name="buttonBox" class="QDialogButtonBox">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<pixmapfunction/>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

23
protoDebuger/lua_wraper.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef LUA_WRAPER_H
#define LUA_WRAPER_H
#include <string.h>
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
void TestLua(){
char buff[256];
int error;
lua_State *L = luaL_newstate(); //打开lua
if(nullptr != L){
printf("shit is nullptr");
}
luaL_openlibs(L); //打开标准库
lua_close(L);
}
#endif // LUA_WRAPER_H

View File

@ -1,11 +1,14 @@
#include <QGuiApplication>
#include <QApplication>
#include <QQmlApplicationEngine>
#include "lua_wraper.h"
#include "dialog.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QApplication app(argc, argv);
// TestLua();
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
@ -14,6 +17,8 @@ int main(int argc, char *argv[])
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
Dialog a;
a.show();
return app.exec();
}