From f4b634c30d4144232575fea8fb9b0ef1be946267 Mon Sep 17 00:00:00 2001 From: liuminghang Date: Wed, 23 Jun 2021 13:54:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbug84900?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 修复问题深色主题存在着问题,之前设置颜色直接按照浅色主题设置的 Log: 与界面有关 Bug: https://pms.uniontech.com/zentao/bug-view-84900.html Change-Id: Ifb3ba7f02a5053b8e18d9759e9ac06dd4dde7fea --- src/mainwidget.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 63a9c8f..14433a4 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -83,11 +83,6 @@ MainWidget::~MainWidget() void MainWidget::setupUi(QWidget *Widget) { - - QPalette pal; - pal.setColor(QPalette::Background, QColor(255, 255, 255, 179)); - setAutoFillBackground(true); - setPalette(pal); DMainWindow *mainWindow = static_cast(this->parent()); if (mainWindow) { mainWindow->titlebar()->setMenuVisible(false); @@ -272,7 +267,7 @@ void MainWidget::openImage(const QString &path) } } -void MainWidget::openImage(const QImage &img,const QString & name) +void MainWidget::openImage(const QImage &img, const QString &name) { createLoadingUi(); if (m_imageview) { @@ -402,6 +397,16 @@ void MainWidget::slotExport() void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType) { if (themeType == DGuiApplicationHelper::DarkType) { + QPalette pal; + pal.setColor(QPalette::Background, QColor(32, 32, 32, 179)); + setAutoFillBackground(true); + setPalette(pal); + if (m_resultWidget) { + QPalette pal; + pal.setColor(QPalette::Background, QColor(40, 40, 40)); + m_resultWidget->setAutoFillBackground(true); + m_resultWidget->setPalette(pal); + } if (m_tipIconLabel) { m_tipIconLabel->setPixmap(QPixmap(":/assets/tip_dark.svg")); m_tipIconLabel->setFixedSize(QSize(14, 14)); @@ -425,6 +430,10 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType) m_imageview->setForegroundBrush(QColor(0, 0, 0, 150)); //设置场景的前景色,类似于遮罩 } } else { + QPalette pal; + pal.setColor(QPalette::Background, QColor(255, 255, 255, 179)); + setAutoFillBackground(true); + setPalette(pal); if (m_tipIconLabel) { m_tipIconLabel->setPixmap(QPixmap(":/assets/tip_light.svg")); m_tipIconLabel->setFixedSize(QSize(14, 14));