OfficeAssistant_Win10/OfficeAssistant_msvc/mainwindow.cpp

34 lines
923 B
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_MainWindow.h" resolved
#include "mainwindow.h"
#include "ui_MainWindow.h"
2023-08-01 23:51:40 +08:00
#include "config.h"
2023-07-26 19:48:14 +08:00
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
2023-08-01 23:51:40 +08:00
QDesktopWidget* desktopWidget = QApplication::desktop();
2023-07-26 19:48:14 +08:00
QRect deskRect = desktopWidget->availableGeometry();
2023-08-01 23:51:40 +08:00
resize(deskRect.width()*0.8, deskRect.height()*0.8);
setWindowState(Qt::WindowMaximized);
2023-07-26 19:48:14 +08:00
mainWindowLayout=new MainWindowLayout(this);
setCentralWidget(mainWindowLayout);
2023-08-01 23:51:40 +08:00
setWindowTitle(QString::fromLocal8Bit(NAME));
QString path = QApplication::applicationDirPath();
path += LOGO_TITLEBAR;
icon = new QIcon(path);
setWindowIcon(*icon);
2023-07-27 13:44:54 +08:00
2023-07-26 19:48:14 +08:00
}
MainWindow::~MainWindow() {
2023-08-01 23:51:40 +08:00
delete icon;
2023-07-31 19:06:37 +08:00
this->setCentralWidget(nullptr);
2023-07-26 19:48:14 +08:00
delete mainWindowLayout;
delete ui;
}