From ace6d29f2b3bcbfaaa68c8235c3867ebe3361124 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Sat, 14 Jul 2018 14:03:35 +0200 Subject: [PATCH] initial qt5 main window --- src/gui/CMakeLists.txt | 16 ++++++++++++---- src/gui/kima2.cpp | 16 +++++++++++----- src/gui/mainwindow.cpp | 6 ++++++ src/gui/mainwindow.h | 18 ++++++++++++++++++ src/gui/mainwindow.ui | 31 +++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 src/gui/mainwindow.cpp create mode 100644 src/gui/mainwindow.h create mode 100644 src/gui/mainwindow.ui diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index bb66887..6425366 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,10 +1,18 @@ +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# Instruct CMake to run moc automatically when needed +set(CMAKE_AUTOMOC ON) +# Create code from a list of Qt designer ui files +set(CMAKE_AUTOUIC ON) + +# Find the QtWidgets library +find_package(Qt5Widgets CONFIG REQUIRED) -set(GUI_HEADERS - -) set(GUI_SOURCES kima2.cpp + mainwindow.cpp + mainwindow.ui ) add_executable(kima2 ${GUI_SOURCES}) -target_link_libraries(kima2 core) \ No newline at end of file +target_link_libraries(kima2 core Qt5::Widgets) diff --git a/src/gui/kima2.cpp b/src/gui/kima2.cpp index 78ae9c1..372e273 100644 --- a/src/gui/kima2.cpp +++ b/src/gui/kima2.cpp @@ -1,10 +1,16 @@ -#include "../core/entity.h" +#include "mainwindow.h" -#include -#include +#include -int main() + +int main(int argc, char* argv[]) { + //Q_INIT_RESOURCE(application); - return 0; + QApplication kimaApp{argc, argv}; + + MainWindow mainWin{}; + mainWin.show(); + + return kimaApp.exec(); } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp new file mode 100644 index 0000000..c94ac19 --- /dev/null +++ b/src/gui/mainwindow.cpp @@ -0,0 +1,6 @@ +#include "mainwindow.h" + +MainWindow::MainWindow() +{ + ui.setupUi(this); +} \ No newline at end of file diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h new file mode 100644 index 0000000..2cc3dad --- /dev/null +++ b/src/gui/mainwindow.h @@ -0,0 +1,18 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "ui_mainwindow.h" +#include + +class MainWindow : public QMainWindow +{ + Q_OBJECT + + public: + MainWindow(); + + private: + Ui::MainWindow ui; +}; + +#endif \ No newline at end of file diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui new file mode 100644 index 0000000..ca4bfd5 --- /dev/null +++ b/src/gui/mainwindow.ui @@ -0,0 +1,31 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + KIMA2 + + + + + + 0 + 0 + 800 + 24 + + + + + + + +