Files
OfficeAssistant_Win10/OfficeAssistant_msvc/mainwindowlayout.cpp
2023-07-30 18:57:41 +08:00

54 lines
1.5 KiB
C++

//
// 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);
mainWindowLayout = this;
ConfigRequest *configRequest = new ConfigRequest;
ConfigResponse *configResponse = new ConfigResponse;
configRequest->sendRequest(configResponse);
navBar=new NavBar(configResponse,this);
mainScreen=new MainScreen();
layout->setMargin(0);
layout->addWidget(navBar,1);
layout->addWidget(mainScreen,7);
setLayout(layout);
connect(this, &MainWindowLayout::clickButton1, mainScreen, &MainScreen::clickButton1);
}
MainWindowLayout::~MainWindowLayout() {
//delete[] list[0];
delete navBar;
//delete layout;
delete ui;
}
void MainWindowLayout::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event);
navBar->resize(navBar->width(),height()/8);
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
}
void MainWindowLayout::clickButton(QString text, QString url) {
QString path = QApplication::applicationDirPath();
path += "/startcalc.exe";
if (text== QString::fromLocal8Bit("¼ÆËãÆ÷")) {
WinExec(path.toStdString().c_str(), SW_SHOW);
}
else{
emit clickButton1(text, url);
}
}
MainWindowLayout *mainWindowLayout;