OfficeAssistant_Win10/OfficeAssistant_msvc/mainwindowlayout.cpp

50 lines
1.4 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);
ConfigRequest *configRequest = new ConfigRequest;
ConfigResponse *configResponse = new ConfigResponse;
configRequest->sendRequest(configResponse);
navBar=new NavBar(configResponse,this);
mainScreen=new MainScreen();
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
//navBar->setSizePolicy(sizePolicy);
layout->setMargin(0);
layout->addWidget(navBar,1);
layout->addWidget(mainScreen,4);
setLayout(layout);
}
MainWindowLayout::~MainWindowLayout() {
delete[] list[0];
delete navBar;
//delete layout;
delete ui;
}
void MainWindowLayout::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event);
navBar->resize(navBar->width(),height()/5);
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
}
/*void MainWindowLayout::paintEvent(QPaintEvent *event) {
QWidget::paintEvent(event);
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
QRectF rect(0, 0, this->width(), this->height()/5);
painter.fillRect(rect, QColor("#333332"));
}*/