From 8865e6c7b7d91d2af08eb166497a2402cc0b5334 Mon Sep 17 00:00:00 2001 From: BENEDEK Date: Tue, 14 May 2024 11:14:22 +0200 Subject: [PATCH] better --- CMakeLists.txt | 17 +++++++++++++++-- inc/graph/server/gui/mainwindow.h | 9 +++++---- src/graph/server/gui/mainwindow.cpp | 12 ++++++------ src/graph/server/gui/mainwindow.ui | 4 ++-- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8bbee6..cc7acd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ if(DEBUG) endif() # build plugins -include_directories("${CMAKE_SOURCE_DIR}/inc") +include_directories("${CMAKE_SOURCE_DIR}/inc" "${CMAKE_SOURCE_DIR}/build") add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins") # build gui server @@ -34,5 +34,18 @@ file(GLOB_RECURSE SERVER_SOURCES "${CMAKE_SOURCE_DIR}/src/graph/server/*.cpp") file(GLOB_RECURSE SERVER_UI "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui") file(GLOB_RECURSE SERVER_RES "${CMAKE_SOURCE_DIR}/src/graph/server/*.qrc") file(GLOB_RECURSE SERVER_HEADERS "${CMAKE_SOURCE_DIR}/inc/graph/server/*.h") -add_executable(server ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS}) + +cmake_print_variables(SERVER_SOURCES) +cmake_print_variables(SERVER_UI) +cmake_print_variables(SERVER_RES) +cmake_print_variables(SERVER_HEADERS) + +qt_wrap_cpp(SERVER_GEN_SRC ${SERVER_SRC}) +qt_wrap_ui(SERVER_GEN_UI ${SERVER_UI}) + +add_executable(server + ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS} + ${SERVER_GEN_SRC} ${SERVER_GEN_UI} + ) + target_link_libraries(server PRIVATE dl Qt6::Widgets) \ No newline at end of file diff --git a/inc/graph/server/gui/mainwindow.h b/inc/graph/server/gui/mainwindow.h index d2ca94d..2eab2a3 100644 --- a/inc/graph/server/gui/mainwindow.h +++ b/inc/graph/server/gui/mainwindow.h @@ -2,8 +2,8 @@ #include #include -#include #include +#include namespace Ui { class MainWindow; @@ -14,10 +14,11 @@ class MainWindow : public QMainWindow { public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); + private: - QMenuBar* menuBar; - QToolBar* toolbar; - QStatusBar* statusBar; + QMenuBar *menuBar; + QToolBar *toolbar; + QStatusBar *statusBar; Ui::MainWindow *ui; }; \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.cpp b/src/graph/server/gui/mainwindow.cpp index 6f97c59..820d95f 100644 --- a/src/graph/server/gui/mainwindow.cpp +++ b/src/graph/server/gui/mainwindow.cpp @@ -1,10 +1,10 @@ #include +#include -MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { - this->menuBar = new QMenuBar(); - setMenuBar(this->menuBar); - this->statusBar = new QStatusBar(); - setStatusBar(this->statusBar); +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { + ui->setupUi(this); } -MainWindow::~MainWindow() {} \ No newline at end of file +MainWindow::~MainWindow() { + delete ui; +} \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.ui b/src/graph/server/gui/mainwindow.ui index 942b328..24e14ec 100644 --- a/src/graph/server/gui/mainwindow.ui +++ b/src/graph/server/gui/mainwindow.ui @@ -21,8 +21,8 @@ - + - + \ No newline at end of file