From ca645a558d67c6075480ac7259307c35e74b3323 Mon Sep 17 00:00:00 2001 From: zjc-zjc-123 <1714105370@qq.com> Date: Tue, 12 Nov 2024 14:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86ui=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E4=BA=86qt=E5=8F=AF=E6=89=A7=E8=A1=8C=E3=80=82?= =?UTF-8?q?=E4=BD=86opencv=E5=87=BA=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 12 ++++++++---- Matrox/ui.cpp | 14 ++++++++++++++ Matrox/ui.h | 8 ++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 Matrox/ui.cpp create mode 100644 Matrox/ui.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a468303..ee1974a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 17) # 设置 OpenCV 路径 if(DEFINED ENV{OpenCV_DIR}) - set(OpenCV_DIR $ENV{OpenCV_DIR}) + set(OpenCV_DIR ENV{OpenCV_DIR}) message(STATUS "OpenCV_DIR set from environment variable: ${OpenCV_DIR}") else() message(FATAL_ERROR "OpenCV_DIR is not set. Please set the OpenCV_DIR environment variable.") @@ -17,7 +17,7 @@ include_directories(${OpenCV_INCLUDE_DIRS}) # 设置 Qt 路径 if(DEFINED ENV{Qt6_DIR}) - set(Qt6_DIR $ENV{Qt6_DIR}) + set(Qt6_DIR ENV{Qt6_DIR}) message(STATUS "Qt6_DIR set from environment variable: ${Qt6_DIR}") else() message(FATAL_ERROR "Qt6_DIR is not set. Please set the Qt6_DIR environment variable.") @@ -33,7 +33,7 @@ set(CMAKE_AUTORCC ON) # 添加可执行文件 cotton_color add_executable(cotton_color cotton_color.cpp) # 链接 OpenCV 和 Qt 库 -target_link_libraries(cotton_color Qt6::Widgets ${OpenCV_LIBS}) +target_link_libraries(cotton_color Qt6::Widgets ${OpenCV_LIBS} comdlg32) # 添加可执行文件 cotton_color add_executable(cotton_range Matrox/color_range.cpp) @@ -46,4 +46,8 @@ add_executable(cotton_color2 cotton_color2.cpp) target_link_libraries(cotton_color2 Qt6::Widgets ${OpenCV_LIBS}) add_executable(color_matching Matrox/template_matching.cpp Matrox/onnx_running.cpp - Matrox/onnx_running.h) + Matrox/onnx_running.h + Matrox/ui.cpp) + +add_executable(ui Matrox/ui.cpp) +target_link_libraries(ui Qt6::Widgets) \ No newline at end of file diff --git a/Matrox/ui.cpp b/Matrox/ui.cpp new file mode 100644 index 0000000..39d3a66 --- /dev/null +++ b/Matrox/ui.cpp @@ -0,0 +1,14 @@ +// +// Created by zjc on 24-11-12. +// + +#include "ui.h" +#include +#include + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + QPushButton button("Hello, Qt!"); + button.show(); + return app.exec(); +} \ No newline at end of file diff --git a/Matrox/ui.h b/Matrox/ui.h new file mode 100644 index 0000000..f7b9caa --- /dev/null +++ b/Matrox/ui.h @@ -0,0 +1,8 @@ +// +// Created by zjc on 24-11-12. +// + +#ifndef UI_H +#define UI_H + +#endif //UI_H