!97 #I8USHY fix mainwindow gridlayout

Merge pull request !97 from likehomedream/UIFIX
This commit is contained in:
KevinDuan 2024-01-09 08:10:27 +00:00 committed by Gitee
commit 6c3e708007
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 13 deletions

View File

@ -136,14 +136,21 @@ void MainWindow::initUI()
QVBoxLayout* alllayout = new QVBoxLayout;
QGridLayout* layout = new QGridLayout;
layout->addWidget(m_globalbtn,0,0);
layout->addWidget(m_iconbtn,0,1);
layout->addWidget(m_cursorbtn,0,2);
layout->addWidget(m_plymouthbtn,1,0);
layout->addWidget(m_grubbtn,1,1);
layout->setSpacing(24);
layout->addWidget(m_globalbtn, 1, 1);
layout->addWidget(m_iconbtn, 1, 2);
layout->addWidget(m_cursorbtn, 1, 3);
layout->addWidget(m_plymouthbtn, 2, 1);
layout->addWidget(m_grubbtn, 2, 2);
layout->setColumnStretch(0, 1);
layout->setRowStretch(0, 1);
layout->setColumnStretch(4, 1);
layout->setRowStretch(3, 1);
m_guideWidget = new QWidget();

View File

@ -45,9 +45,14 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent)
}
}
QGridLayout *layout = new QGridLayout;
int row = 0;
int col = 0;
layout->setSpacing(24);
int row = 1;
int col = 1;
layout->setColumnStretch(0, 1);
layout->setRowStretch(0, 1);
layout->setColumnStretch(5, 1);
layout->setRowStretch(5, 1);
foreach (QString folder, validFolders) {
HistoryButton *button = new HistoryButton(this);
HistoryInfoLoad *info = new HistoryInfoLoad(folder);
@ -69,8 +74,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent)
});
layout->addWidget(button, row, col);
col++;
if (col == 4) {
col = 0;
if (col == 5) {
col = 1;
row++;
}
connect(this,&HistoryWidget::updateInfo,info,&HistoryInfoLoad::updateHistoryInfo);
@ -114,8 +119,13 @@ void HistoryWidget::updateHistoryDir()
}
QGridLayout *layout = new QGridLayout;
layout->setSpacing(24);
int row = 0;
int col = 0;
int col = 1;
layout->setColumnStretch(0, 1);
layout->setRowStretch(0, 1);
layout->setColumnStretch(5, 1);
layout->setRowStretch(5, 1);
foreach (QString folder, validFolders) {
HistoryButton *button = new HistoryButton(this);
@ -139,8 +149,8 @@ void HistoryWidget::updateHistoryDir()
layout->addWidget(button, row, col);
col++;
if (col == 4) {
col = 0;
if (col == 5) {
col = 1;
row++;
}
}