Browse Source

修复程序打包后,异常语法不生效的BUG

master
zhaohe 1 year ago
parent
commit
abd4958fc3
  1. 6
      .vscode/settings.json
  2. 11
      CMakeLists.txt
  3. 3
      src/basic/qcustomplot.h
  4. 4
      src/basic/widgetplot2d.cpp
  5. 28
      src/tab/plate_code_scaner_tab.cpp

6
.vscode/settings.json

@ -123,7 +123,11 @@
"xtree": "cpp", "xtree": "cpp",
"xutility": "cpp", "xutility": "cpp",
"qstatusbar": "cpp", "qstatusbar": "cpp",
"qtnumeric": "cpp"
"qtnumeric": "cpp",
"qtprintsupport": "cpp",
"qstandardpaths": "cpp",
"qcolordialog": "cpp",
"qfiledialog": "cpp"
}, },
"files.autoGuessEncoding": false, "files.autoGuessEncoding": false,
} }

11
CMakeLists.txt

@ -13,7 +13,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) 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)
# PrintSupportEnigmaVirtual使try...catch便
include_directories(libxsync/include) include_directories(libxsync/include)
include_directories(src) include_directories(src)
@ -37,6 +39,7 @@ set(PROJECT_SOURCES
src/basic/qcustomplot.cpp src/basic/qcustomplot.cpp
src/basic/widgetplot2d.ui src/basic/widgetplot2d.ui
src/basic/zcsv.cpp src/basic/zcsv.cpp
src/basic/widgetplot2d.cpp
iflytop_canbus/iflytop_canbus_master.cpp iflytop_canbus/iflytop_canbus_master.cpp
iflytop_canbus/waveshare_can.cpp iflytop_canbus/waveshare_can.cpp
@ -70,18 +73,18 @@ set(PROJECT_SOURCES
src/basic/format_memory.cpp src/basic/format_memory.cpp
src/basic/smtp2_constant.cpp src/basic/smtp2_constant.cpp
src/basic/widgetplot2d.cpp
app.rc app.rc
) )
add_executable(a8000_pc_upper
add_executable(a8000_pc_upper WIN32
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
target_link_options(a8000_pc_upper PRIVATE -static -static-libgcc -static-libstdc++) 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 set_target_properties(a8000_pc_upper PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com

3
src/basic/qcustomplot.h

@ -69,6 +69,7 @@
#include <qmath.h> #include <qmath.h>
#include <limits> #include <limits>
#include <algorithm> #include <algorithm>
#define QT_NO_PRINTER
#ifdef QCP_OPENGL_FBO #ifdef QCP_OPENGL_FBO
# include <QtGui/QOpenGLContext> # include <QtGui/QOpenGLContext>
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) # if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -94,7 +95,7 @@
#else #else
# include <QtNumeric> # include <QtNumeric>
# include <QtWidgets/QWidget> # include <QtWidgets/QWidget>
# include <QtPrintSupport/QtPrintSupport>
// # include <QtPrintSupport/QtPrintSupport>
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
# include <QtCore/QElapsedTimer> # include <QtCore/QElapsedTimer>

4
src/basic/widgetplot2d.cpp

@ -1,6 +1,10 @@
#include "widgetplot2d.h" #include "widgetplot2d.h"
#include <QDebug> #include <QDebug>
#include <QStandardPaths>
#include <QColorDialog>
#include <QFileDialog>
#include <QToolTip>
#include "ui_widgetplot2d.h" #include "ui_widgetplot2d.h"
#include "zcsv.hpp" #include "zcsv.hpp"

28
src/tab/plate_code_scaner_tab.cpp

@ -74,24 +74,24 @@ void PlateCodeScanerTab::construct(QTabWidget *fathertab) {
ZQUI::ins()->ishow("pointNum:%d", rawcode.len / 2); 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) { box->newFunc("读取条码", {}, [this](int argn, const char **args) {

Loading…
Cancel
Save