connected to gui
This commit is contained in:
parent
8a6e916876
commit
d77a32e6e6
8 changed files with 126 additions and 26 deletions
|
|
@ -30,19 +30,20 @@ endif()
|
|||
|
||||
set(GUI_SRCS
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
mainwindow.cpp
|
||||
MachineController.cpp
|
||||
)
|
||||
|
||||
set(GUI_HDRS
|
||||
MainWindow.h
|
||||
mainwindow.h
|
||||
MachineController.h
|
||||
)
|
||||
|
||||
add_executable(simulator_qt ${GUI_SRCS} ${GUI_HDRS})
|
||||
|
||||
# Use top-level include folder (works when added with add_subdirectory)
|
||||
target_include_directories(simulator_qt PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
# Allow the generated UI headers (from AUTOUIC) to be found in the build dir
|
||||
# and also include the top-level include folder (works when added with add_subdirectory)
|
||||
target_include_directories(simulator_qt PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
# Link to core library target (must be defined by top-level CMake)
|
||||
target_link_libraries(simulator_qt PRIVATE simulator_lib ${QT_LIB})
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
#include "MainWindow.h"
|
||||
#include "MachineController.h"
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
QWidget *central = new QWidget(this);
|
||||
auto *layout = new QVBoxLayout(central);
|
||||
auto *label = new QLabel("SIC/XE Simulator — GUI stub", central);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(label);
|
||||
setCentralWidget(central);
|
||||
|
||||
m_controller = new MachineController(this);
|
||||
setWindowTitle("SIC/XE Simulator");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() = default;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <QApplication>
|
||||
#include "MainWindow.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication app(argc, argv);
|
||||
|
|
|
|||
14
simulator_SIC_XE/gui/qt/mainwindow.cpp
Normal file
14
simulator_SIC_XE/gui/qt/mainwindow.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
22
simulator_SIC_XE/gui/qt/mainwindow.h
Normal file
22
simulator_SIC_XE/gui/qt/mainwindow.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
25
simulator_SIC_XE/gui/qt/mainwindow.ui
Normal file
25
simulator_SIC_XE/gui/qt/mainwindow.ui
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version='1.0'?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>MainWindow</class>
|
||||
<widget name="MainWindow" class="QMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget name="menubar" class="QMenuBar"/>
|
||||
<widget name="centralwidget" class="QWidget"/>
|
||||
<widget name="statusbar" class="QStatusBar"/>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue