OfficeAssistant_Win10/OfficeAssistant_msvc/mainwindowlayout.cpp

54 lines
1.5 KiB
C++
Raw Normal View History

2023-07-26 19:48:14 +08:00
//
// Created by HW on 2023/07/26.
//
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindowLagout.h" resolved
#include "mainwindowlayout.h"
#include "ui_MainWindowLayout.h"
MainWindowLayout::MainWindowLayout(QWidget *parent) :
QWidget(parent), ui(new Ui::MainWindowLayout) {
ui->setupUi(this);
layout=new QVBoxLayout(this);
2023-07-30 13:57:54 +08:00
mainWindowLayout = this;
2023-07-30 01:06:42 +08:00
ConfigRequest *configRequest = new ConfigRequest;
ConfigResponse *configResponse = new ConfigResponse;
configRequest->sendRequest(configResponse);
navBar=new NavBar(configResponse,this);
2023-07-27 13:44:54 +08:00
mainScreen=new MainScreen();
2023-07-30 18:57:41 +08:00
2023-07-26 19:48:14 +08:00
layout->setMargin(0);
2023-07-27 13:44:54 +08:00
layout->addWidget(navBar,1);
2023-07-30 18:57:41 +08:00
layout->addWidget(mainScreen,7);
2023-07-26 19:48:14 +08:00
setLayout(layout);
2023-07-30 18:57:41 +08:00
connect(this, &MainWindowLayout::clickButton1, mainScreen, &MainScreen::clickButton1);
2023-07-26 19:48:14 +08:00
}
MainWindowLayout::~MainWindowLayout() {
2023-07-30 13:57:54 +08:00
//delete[] list[0];
2023-07-26 19:48:14 +08:00
delete navBar;
2023-07-27 13:44:54 +08:00
//delete layout;
2023-07-26 19:48:14 +08:00
delete ui;
}
2023-07-27 13:44:54 +08:00
void MainWindowLayout::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event);
2023-07-30 18:57:41 +08:00
navBar->resize(navBar->width(),height()/8);
2023-07-27 13:44:54 +08:00
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
}
2023-07-30 10:26:41 +08:00
void MainWindowLayout::clickButton(QString text, QString url) {
2023-07-30 18:57:41 +08:00
QString path = QApplication::applicationDirPath();
path += "/startcalc.exe";
if (text== QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) {
WinExec(path.toStdString().c_str(), SW_SHOW);
2023-07-30 10:26:41 +08:00
}
else{
emit clickButton1(text, url);
}
}
2023-07-27 13:44:54 +08:00
2023-07-30 10:26:41 +08:00
MainWindowLayout *mainWindowLayout;