auto_bus/src/mainwindow.cpp

56 lines
1.2 KiB
C++
Raw Normal View History

2022-06-10 19:52:43 +08:00
//
// Created by ricardo on 2022/6/10.
//
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
#include "header/moc_mainwindow.cpp"
#include "form/ui_MainWindow.h"
2022-06-25 16:35:07 +08:00
#include "mainwindow.h"
2022-06-10 19:52:43 +08:00
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
ui = new Ui::MainWindow;
central_widget = new CentralWidget;
2022-06-25 16:35:07 +08:00
controller = new BusControllerModel;
2022-06-10 19:52:43 +08:00
ui->setupUi(this);
this->setCentralWidget(central_widget);
SetMenuBarConnection();
}
MainWindow::~MainWindow()
{
delete ui;
delete central_widget;
2022-06-25 16:35:07 +08:00
delete controller;
2022-06-10 19:52:43 +08:00
}
void MainWindow::SetMenuBarConnection()
{
QObject::connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
2022-06-25 16:35:07 +08:00
QObject::connect(ui->actionRead_ConfigFile, &QAction::triggered, this, &MainWindow::ReadConfigFileButtonClicked);
}
void MainWindow::ReadConfigFileButtonClicked()
{
QString file_name = QFileDialog::getOpenFileName(
this,
"打开配置文件",
"C:/",
"Config Files(*.dic)"
);
if(file_name.isEmpty())
{
qDebug() << "文件名为空";
}
else
{
qDebug() << file_name;
emit OpenConfigFileSignal(file_name);
}
2022-06-10 19:52:43 +08:00
}