fix: 修复非deepin的wayland环境下ui显示

This commit is contained in:
2022-12-23 16:30:14 +08:00
parent 8b31db843c
commit 613327b2cc
2 changed files with 31 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
#include <DWidgetUtil>
#include <DGuiApplicationHelper>
#include <DApplicationSettings>
#include <QSizePolicy>
#define AppPageApplist 0
@@ -63,8 +64,7 @@ MainWindow::MainWindow(QWidget *parent)
{
qDebug() << "投稿器不存在,跳转页面";
openUrl(submitterSpk);
}
});
} });
// 主题切换
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [=](DGuiApplicationHelper::ColorType themeType)
@@ -153,6 +153,10 @@ MainWindow::MainWindow(QWidget *parent)
downloadlistwidget->hide();
backButtom->hide();
ui->titlebar->setIcon(QIcon::fromTheme(":/icon/logo.svg"));
// Check wayland configs
QSettings readConfig(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
QWidget *w_titlebar = new QWidget(ui->titlebar);
QHBoxLayout *ly_titlebar = new QHBoxLayout(w_titlebar);
QLabel *title = new QLabel(this);
@@ -160,7 +164,16 @@ MainWindow::MainWindow(QWidget *parent)
searchEdit->setPlaceholderText(tr("Search or enter spk://"));
ly_titlebar->addWidget(title);
ly_titlebar->addWidget(backButtom);
ly_titlebar->addStretch(2.5);
if (!readConfig.value("build/isDeepinOS").toBool() && readConfig.value("build/useWayland").toBool())
{
ly_titlebar->addStretch(1);
}
else
{
ly_titlebar->addStretch(2);
}
ly_titlebar->addWidget(searchEdit);
ly_titlebar->addWidget(downloadButton);
ly_titlebar->addStretch(1);