Skip to content

Commit

Permalink
fix: wrong combobox window palette
Browse files Browse the repository at this point in the history
Fix wrong combobox window palette

Log: Fix wrong combobox window palette
Bug: https://pms.uniontech.com/bug-view-241599.html
  • Loading branch information
rb-union committed Jul 23, 2024
1 parent b89c484 commit 902f42f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mainwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <DFontSizeManager>
#include <DHiDPIHelper>
#include <DDciIcon>
#include <DComboBox>
#include <QSettings>
#include <DStandardPaths>

Expand Down Expand Up @@ -168,7 +167,7 @@ void MainWidget::setupUi(QWidget *Widget)

//设置语种选择框
auto recLabel = new DLabel(tr("Recognize language"));
auto languageSelectBox = new DComboBox;
languageSelectBox = new DComboBox(this);
languageSelectBox->setFixedSize(160, 36);
languageSelectBox->addItems({tr("Simplified Chinese"), tr("English"), tr("Traditional Chinese")});
static std::map<QString, int> languageIndexMap{ {"zh-Hans_en", 0},
Expand Down Expand Up @@ -615,6 +614,13 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
m_exportBtn->setIconSize(QSize(14, 14));
}

// 手动设置,防止被后续更新冲掉调色版
if (languageSelectBox) {
QPalette originPal;
originPal.setBrush(QPalette::Window, originPal.window());
languageSelectBox->setPalette(originPal);
}

//无法使用DCI图标的部分
if (themeType == DGuiApplicationHelper::DarkType) {
QPalette pal;
Expand Down
4 changes: 4 additions & 0 deletions src/mainwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <DGuiApplicationHelper>
#include <DStackedWidget>
#include <DFrame>
#include <DComboBox>

#include <QMutex>
#include <DToolButton>
Expand Down Expand Up @@ -108,6 +109,9 @@ private slots:
int m_isEndThread = 1;
QSettings *ocrSetting;
std::atomic_bool m_needReRunRec = false;

DComboBox *languageSelectBox {nullptr}; // 语言选择框

signals:
void sigResult(const QString &);

Expand Down

0 comments on commit 902f42f

Please sign in to comment.