initial qt5 main window

This commit is contained in:
Martin Brodbeck 2018-07-14 14:03:35 +02:00
parent 68448bd4d9
commit ace6d29f2b
5 changed files with 78 additions and 9 deletions

View File

@ -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)
target_link_libraries(kima2 core Qt5::Widgets)

View File

@ -1,10 +1,16 @@
#include "../core/entity.h"
#include "mainwindow.h"
#include <iostream>
#include <boost/uuid/uuid_io.hpp>
#include <QApplication>
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();
}

6
src/gui/mainwindow.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "mainwindow.h"
MainWindow::MainWindow()
{
ui.setupUi(this);
}

18
src/gui/mainwindow.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "ui_mainwindow.h"
#include <QMainWindow>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
private:
Ui::MainWindow ui;
};
#endif

31
src/gui/mainwindow.ui Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>KIMA2</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>