best so far

This commit is contained in:
BENEDEK 2024-05-14 11:30:26 +02:00
parent 8865e6c7b7
commit 1787f701e9
5 changed files with 33 additions and 15 deletions

View File

@ -28,7 +28,6 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
# qt_standard_project_setup()
file(GLOB_RECURSE SERVER_SOURCES "${CMAKE_SOURCE_DIR}/src/graph/server/*.cpp") 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_UI "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui")
@ -46,6 +45,6 @@ qt_wrap_ui(SERVER_GEN_UI ${SERVER_UI})
add_executable(server add_executable(server
${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS} ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS}
${SERVER_GEN_SRC} ${SERVER_GEN_UI} ${SERVER_GEN_SRC} ${SERVER_GEN_UI}
) )
target_link_libraries(server PRIVATE dl Qt6::Widgets) target_link_libraries(server PRIVATE dl Qt6::Widgets)

View File

@ -9,16 +9,17 @@ namespace Ui {
class MainWindow; class MainWindow;
} }
namespace Graph::GUI {
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
public: public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
private: private slots:
QMenuBar *menuBar; void on_actionExit_triggered();
QToolBar *toolbar;
QStatusBar *statusBar;
private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
}; };
} // namespace Graph::GUI

View File

@ -1,10 +1,15 @@
#include <graph/server/gui/mainwindow.h> #include <graph/server/gui/mainwindow.h>
#include <ui_mainwindow.h> #include <ui_mainwindow.h>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { namespace Graph::GUI {
ui->setupUi(this); MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
} }
MainWindow::~MainWindow() { MainWindow::~MainWindow() { delete ui; }
delete ui;
} void MainWindow::on_actionExit_triggered() {
this->close();
}
} // namespace Graph::GUI

View File

@ -13,10 +13,23 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>640</width>
<width>480</width> <height>480</height>
</rect> </rect>
</property> </property>
<widget class="QMenuBar" name="menuBar"/> <widget class="QMenuBar" name="menuBar">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionExit"/>
</widget>
<addaction name="menuFile"/>
</widget>
<action name="actionExit">
<property name="text">
<string>E&amp;xit</string>
</property>
</action>
<widget class="QToolBar" name="toolBar"/> <widget class="QToolBar" name="toolBar"/>
<widget class="QWidget" name="centralWidget"/> <widget class="QWidget" name="centralWidget"/>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>

View File

@ -9,7 +9,7 @@ int main(int argc, char** argv) {
plugin.init((update_callback_t)1); plugin.init((update_callback_t)1);
QApplication app(argc, argv); QApplication app(argc, argv);
MainWindow window; Graph::GUI::MainWindow window;
window.show(); window.show();
return app.exec(); return app.exec();