From abd4958fc3c3592d09c9172e7f27cc24a1dee0f2 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 26 Jun 2024 11:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A8=8B=E5=BA=8F=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=90=8E=EF=BC=8C=E5=BC=82=E5=B8=B8=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 6 +++++- CMakeLists.txt | 11 +++++++---- src/basic/qcustomplot.h | 3 ++- src/basic/widgetplot2d.cpp | 4 ++++ src/tab/plate_code_scaner_tab.cpp | 28 ++++++++++++++-------------- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ae93da2..2e6e834 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -123,7 +123,11 @@ "xtree": "cpp", "xutility": "cpp", "qstatusbar": "cpp", - "qtnumeric": "cpp" + "qtnumeric": "cpp", + "qtprintsupport": "cpp", + "qstandardpaths": "cpp", + "qcolordialog": "cpp", + "qfiledialog": "cpp" }, "files.autoGuessEncoding": false, } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e70274d..38abc08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets PrintSupport SerialPort Charts Concurrent REQUIRED) +# find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets PrintSupport SerialPort Charts Concurrent REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets SerialPort Charts Concurrent REQUIRED) +# 加入 PrintSupport库之后,EnigmaVirtual打包的文件会出现无法使用try...catch的问题,具体表现为,即便捕获了异常,程序依然会卡死。 include_directories(libxsync/include) include_directories(src) @@ -37,6 +39,7 @@ set(PROJECT_SOURCES src/basic/qcustomplot.cpp src/basic/widgetplot2d.ui src/basic/zcsv.cpp + src/basic/widgetplot2d.cpp iflytop_canbus/iflytop_canbus_master.cpp iflytop_canbus/waveshare_can.cpp @@ -70,18 +73,18 @@ set(PROJECT_SOURCES src/basic/format_memory.cpp src/basic/smtp2_constant.cpp - src/basic/widgetplot2d.cpp app.rc ) -add_executable(a8000_pc_upper +add_executable(a8000_pc_upper WIN32 ${PROJECT_SOURCES} ) target_link_options(a8000_pc_upper PRIVATE -static -static-libgcc -static-libstdc++) -target_link_libraries(a8000_pc_upper PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::SerialPort Qt${QT_VERSION_MAJOR}::Charts Qt${QT_VERSION_MAJOR}::Concurrent wsock32) +# target_link_libraries(a8000_pc_upper PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::SerialPort Qt${QT_VERSION_MAJOR}::Charts Qt${QT_VERSION_MAJOR}::Concurrent wsock32) +target_link_libraries(a8000_pc_upper PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::SerialPort Qt${QT_VERSION_MAJOR}::Charts Qt${QT_VERSION_MAJOR}::Concurrent wsock32) set_target_properties(a8000_pc_upper PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com diff --git a/src/basic/qcustomplot.h b/src/basic/qcustomplot.h index 8f0f78b..1b3795e 100644 --- a/src/basic/qcustomplot.h +++ b/src/basic/qcustomplot.h @@ -69,6 +69,7 @@ #include #include #include +#define QT_NO_PRINTER #ifdef QCP_OPENGL_FBO # include # if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -94,7 +95,7 @@ #else # include # include -# include +// # include #endif #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) # include diff --git a/src/basic/widgetplot2d.cpp b/src/basic/widgetplot2d.cpp index f585d5b..9c776ee 100644 --- a/src/basic/widgetplot2d.cpp +++ b/src/basic/widgetplot2d.cpp @@ -1,6 +1,10 @@ #include "widgetplot2d.h" #include +#include +#include +#include +#include #include "ui_widgetplot2d.h" #include "zcsv.hpp" diff --git a/src/tab/plate_code_scaner_tab.cpp b/src/tab/plate_code_scaner_tab.cpp index b0fbe4b..de6de88 100644 --- a/src/tab/plate_code_scaner_tab.cpp +++ b/src/tab/plate_code_scaner_tab.cpp @@ -74,24 +74,24 @@ void PlateCodeScanerTab::construct(QTabWidget *fathertab) { ZQUI::ins()->ishow("pointNum:%d", rawcode.len / 2); - DoInUi([this, rawcode]() { - WidgetPlot2D *plot2d = new WidgetPlot2D(); - QStringList lines; - lines.push_back("line1"); - plot2d->initGraphName(lines); + // DoInUi([this, rawcode]() { + // WidgetPlot2D *plot2d = new WidgetPlot2D(); + // QStringList lines; + // lines.push_back("line1"); + // plot2d->initGraphName(lines); - int16_t *point_table = (int16_t *)rawcode.buf; + // int16_t *point_table = (int16_t *)rawcode.buf; - for (int i = 0; i < rawcode.len / 2; i++) { - plot2d->addData("line1", point_table[i]); - } + // for (int i = 0; i < rawcode.len / 2; i++) { + // plot2d->addData("line1", point_table[i]); + // } - for (int i = 0; i < 15; i++) { - plot2d->addRefLine(i * 12 + 6); - } + // for (int i = 0; i < 15; i++) { + // plot2d->addRefLine(i * 12 + 6); + // } - plot2d->show(); - }); + // plot2d->show(); + // }); }); box->newFunc("读取条码", {}, [this](int argn, const char **args) {