OfficeAssistant_Win10/OfficeAssistant_msvc/mainwindowlayout.cpp

52 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();
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
//navBar->setSizePolicy(sizePolicy);
2023-07-26 19:48:14 +08:00
layout->setMargin(0);
2023-07-27 13:44:54 +08:00
layout->addWidget(navBar,1);
layout->addWidget(mainScreen,4);
2023-07-26 19:48:14 +08:00
setLayout(layout);
}
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);
navBar->resize(navBar->width(),height()/5);
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
}
2023-07-30 10:26:41 +08:00
void MainWindowLayout::clickButton(QString text, QString url) {
if (text == "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") {
ShellExecute(GetDesktopWindow(), L"open", L"startclas.exe", L"", QApplication::applicationDirPath().toStdWString().c_str(), SW_SHOW);
}
else{
emit clickButton1(text, url);
}
}
2023-07-27 13:44:54 +08:00
2023-07-30 10:26:41 +08:00
MainWindowLayout *mainWindowLayout;