完成1.更新数据库2.获取导航栏
This commit is contained in:
@ -1,71 +1,74 @@
|
||||
//
|
||||
// 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"
|
||||
#include "mysettingsdialog.h"
|
||||
|
||||
MainWindowLayout::MainWindowLayout(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::MainWindowLayout) {
|
||||
ui->setupUi(this);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
layout=new QVBoxLayout(this);
|
||||
mainWindowLayout = this;
|
||||
ConfigRequest *configRequest = new ConfigRequest;
|
||||
configResponse = new ConfigResponse;
|
||||
configRequest->sendRequest(configResponse);
|
||||
mainScreen = new MainScreen(this);
|
||||
navBar=new NavBar(configResponse,mainScreen,this);
|
||||
navBar->setMinimumHeight(0);
|
||||
navBar->setMaximumHeight(this->height() / 8);
|
||||
mainScreen->setMinimumHeight(0);
|
||||
//navBar->setAttribute(Qt::WA_DeleteOnClose);
|
||||
delete configRequest;
|
||||
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
|
||||
//navBar->setSizePolicy(sizePolicy);
|
||||
//layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(navBar,1);
|
||||
layout->addWidget(mainScreen,7);
|
||||
layout->setMargin(0);
|
||||
setLayout(layout);
|
||||
connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1);
|
||||
}
|
||||
|
||||
MainWindowLayout::~MainWindowLayout() {
|
||||
delete configResponse;
|
||||
layout->removeWidget(mainScreen);
|
||||
layout->removeWidget(navBar);
|
||||
delete mainScreen;
|
||||
//delete[] list[0];
|
||||
delete navBar;
|
||||
delete layout;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindowLayout::resizeEvent(QResizeEvent *event) {
|
||||
QWidget::resizeEvent(event);
|
||||
navBar->setMaximumHeight(event->size().height()/8);
|
||||
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||
}
|
||||
|
||||
void MainWindowLayout::clickButton(QString text, QString url) {
|
||||
QString path = QApplication::applicationDirPath();
|
||||
path += "/app/startcalc.exe";
|
||||
path.replace("/", "\\");
|
||||
if (text== QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) {
|
||||
WinExec(path.toStdString().c_str(), SW_SHOW);
|
||||
}
|
||||
else if (text == QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) {
|
||||
MySettingsDialog *settings = new MySettingsDialog;
|
||||
settings->exec();
|
||||
delete settings;
|
||||
}
|
||||
else{
|
||||
emit clickButton1(text, url);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowLayout *mainWindowLayout;
|
||||
//
|
||||
// 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"
|
||||
#include "mysettingsdialog.h"
|
||||
#include "sqlitehelper.h"
|
||||
MainWindowLayout::MainWindowLayout(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::MainWindowLayout) {
|
||||
ui->setupUi(this);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
layout=new QVBoxLayout(this);
|
||||
mainWindowLayout = this;
|
||||
SQLiteHelper sqlite_helper;
|
||||
QList<ButtonStruct> list;
|
||||
sqlite_helper.get_software(&list);
|
||||
ConfigRequest *configRequest = new ConfigRequest;
|
||||
configResponse = new ConfigResponse;
|
||||
configRequest->sendRequest(configResponse);
|
||||
mainScreen = new MainScreen(this);
|
||||
navBar=new NavBar(configResponse,mainScreen,this);
|
||||
navBar->setMinimumHeight(0);
|
||||
navBar->setMaximumHeight(this->height() / 8);
|
||||
mainScreen->setMinimumHeight(0);
|
||||
//navBar->setAttribute(Qt::WA_DeleteOnClose);
|
||||
delete configRequest;
|
||||
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
|
||||
//navBar->setSizePolicy(sizePolicy);
|
||||
//layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(navBar,1);
|
||||
layout->addWidget(mainScreen,7);
|
||||
layout->setMargin(0);
|
||||
setLayout(layout);
|
||||
connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1);
|
||||
}
|
||||
|
||||
MainWindowLayout::~MainWindowLayout() {
|
||||
delete configResponse;
|
||||
layout->removeWidget(mainScreen);
|
||||
layout->removeWidget(navBar);
|
||||
delete mainScreen;
|
||||
//delete[] list[0];
|
||||
delete navBar;
|
||||
delete layout;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindowLayout::resizeEvent(QResizeEvent *event) {
|
||||
QWidget::resizeEvent(event);
|
||||
navBar->setMaximumHeight(event->size().height()/8);
|
||||
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||
}
|
||||
|
||||
void MainWindowLayout::clickButton(QString text, QString url) {
|
||||
QString path = QApplication::applicationDirPath();
|
||||
path += "/app/startcalc.exe";
|
||||
path.replace("/", "\\");
|
||||
if (text== QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) {
|
||||
WinExec(path.toStdString().c_str(), SW_SHOW);
|
||||
}
|
||||
else if (text == QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) {
|
||||
MySettingsDialog *settings = new MySettingsDialog;
|
||||
settings->exec();
|
||||
delete settings;
|
||||
}
|
||||
else{
|
||||
emit clickButton1(text, url);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowLayout *mainWindowLayout;
|
||||
|
Reference in New Issue
Block a user