From ec4329bd6fb5c003a0b4389d39ef02801b6d99a4 Mon Sep 17 00:00:00 2001 From: lixueman Date: Thu, 21 Jul 2022 15:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=BC=BA=E8=B0=83=E8=89=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E6=90=9C=E7=B4=A2=E6=A1=86=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=B8=8D=E5=8F=8A=E6=97=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Button/function_classify_button.cpp | 11 ++++++++--- .../Button/letter_classify_button.cpp | 11 ++++++++--- src/UserInterface/full_mainwindow.cpp | 9 ++++++++- src/UserInterface/mainwindow.cpp | 18 +++++++++++++++++- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/UserInterface/Button/function_classify_button.cpp b/src/UserInterface/Button/function_classify_button.cpp index 8ddabe1..ffed89c 100755 --- a/src/UserInterface/Button/function_classify_button.cpp +++ b/src/UserInterface/Button/function_classify_button.cpp @@ -117,11 +117,16 @@ void FunctionClassifyButton::paintEvent(QPaintEvent *e) painter.save(); QColor color; - if ( g_curStyle == "ukui-light") { - color = Qt::black; + if (m_fullscreen) { + color = Qt::white; } else { - color = Qt::white; + if ( g_curStyle == "ukui-light") { + color = Qt::black; + } else { + color = Qt::white; + } } + color.setAlphaF(0.9); painter.setPen(color); painter.drawText(option.rect, Qt::AlignCenter, m_category); diff --git a/src/UserInterface/Button/letter_classify_button.cpp b/src/UserInterface/Button/letter_classify_button.cpp index 624c38e..11073a8 100755 --- a/src/UserInterface/Button/letter_classify_button.cpp +++ b/src/UserInterface/Button/letter_classify_button.cpp @@ -102,11 +102,16 @@ void LetterClassifyButton::paintEvent(QPaintEvent *e) painter.save(); QColor color; - if ( g_curStyle == "ukui-light") { - color = Qt::black; + if (m_fullscreen) { + color = Qt::white; } else { - color = Qt::white; + if ( g_curStyle == "ukui-light") { + color = Qt::black; + } else { + color = Qt::white; + } } + color.setAlphaF(0.9); painter.setPen(color); painter.drawText(option.rect, Qt::AlignCenter, m_letter); diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index 3ccb33f..555c6a6 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -123,6 +123,13 @@ void FullMainWindow::initSearchUI() if (key.contains(QString("styleName"))) { changeStyle(); } + + if (key.contains(QString("theme-color"))) { + QString highLightColor = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16); + QString color = highLightColor.mid(2, 6); + QString searchStyle = QString("border-radius: 13px; border:1px solid #%1; background: transparent;").arg(color); + m_lineEdit->setStyleSheet(searchStyle); + } }); } @@ -294,7 +301,7 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event) QString style; if (event->type() == QEvent::FocusIn) { - QString highLightColor = QString::number(m_lineEdit->palette().color(QPalette::Highlight).rgba(), 16); + QString highLightColor = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16); QString color = highLightColor.mid(2, 6); style = QString("QLineEdit{border:2px solid #%1;background-color:%2;border-radius:17px;color:#ffffff;}") .arg(color).arg(QueryLineEditClickedBackground); diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index cc67dcb..355a8bd 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -275,6 +275,13 @@ void MainWindow::initGsettings() if (key.contains(QString("styleName"))) { changeStyle(); } + + if (key.contains(QString("theme-color"))) { + QString highLightColor = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16); + QString color = highLightColor.mid(2, 6); + QString searchStyle = QString("border-radius: 13px; border:1px solid #%1; background: transparent;").arg(color); + m_lineEdit->setStyleSheet(searchStyle); + } }); } } @@ -317,7 +324,7 @@ void MainWindow::initSearchUi() m_leftTopSearchHorizontalLayout->setContentsMargins(8, 0, 8, 0); m_lineEdit = new QLineEdit(m_minSearchPage); m_lineEdit->setMinimumSize(QSize(30, 26)); - QString highLightColor = QString::number(m_lineEdit->palette().color(QPalette::Highlight).rgba(), 16); + QString highLightColor = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16); QString color = highLightColor.mid(2, 6); QString searchStyle = QString("border-radius: 13px; border:1px solid #%1; background: transparent;").arg(color); m_lineEdit->setStyleSheet(searchStyle); @@ -942,6 +949,15 @@ bool MainWindow::eventFilter(QObject *target, QEvent *event) } } + if (target == m_lineEdit) { + if (event->type() == QEvent::FocusIn) { + QString highLightColor = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16); + QString color = highLightColor.mid(2, 6); + QString searchStyle = QString("border-radius: 13px; border:1px solid #%1; background: transparent;").arg(color); + m_lineEdit->setStyleSheet(searchStyle); + } + } + if (event->type() == QEvent::KeyPress) { QKeyEvent *ke = (QKeyEvent *)event;