From bd90c1b701480eaae397cb56b9fef0db9fcfa3de Mon Sep 17 00:00:00 2001 From: lixueman Date: Wed, 20 Jul 2022 13:41:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?#130526,=E4=BF=AE=E6=94=B9=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E5=92=8C=E6=94=B6=E8=97=8F=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E9=AB=98=E4=BA=AE=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/full_mainwindow.cpp | 14 +++++++---- src/UserInterface/mainwindow.cpp | 35 ++++++++++++++------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index 3c77fd5..3ccb33f 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -3,6 +3,7 @@ #include #include #include "utility.h" +#include FullMainWindow::FullMainWindow(QWidget *parent) : QMainWindow(parent) @@ -290,12 +291,15 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event) { if (watched == m_lineEdit) { m_isSearching = true; - char style[200]; + QString style; if (event->type() == QEvent::FocusIn) { - sprintf(style, "QLineEdit{border:2px solid %s;background-color:%s;border-radius:17px;color:#ffffff;}", - QueryLineEditClickedBorder, QueryLineEditClickedBackground); + QString highLightColor = QString::number(m_lineEdit->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); m_lineEdit->setStyleSheet(style); + myDebug() <text().isEmpty()) { qDebug() << "bool FullMainWindow::eventFilter(QObject *watched, QEvent *event)" << m_queryWid->layout()->count(); @@ -310,8 +314,8 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event) m_lineEdit->setTextMargins(26, 0, 0, 0); } } else if (event->type() == QEvent::FocusOut && m_lineEdit->text().isEmpty()) { - sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:17px;color:#ffffff;}", - QueryLineEditClickedBorderDefault, QueryLineEditClickedBackground); + style = QString("QLineEdit{border:1px solid %1;background-color:%2;border-radius:17px;color:#ffffff;}") + .arg(QueryLineEditClickedBorderDefault).arg(QueryLineEditClickedBackground); m_lineEdit->setStyleSheet(style); resetEditline(); } diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 1f09418..cc67dcb 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -33,6 +33,7 @@ #include #include #include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -316,7 +317,10 @@ void MainWindow::initSearchUi() m_leftTopSearchHorizontalLayout->setContentsMargins(8, 0, 8, 0); m_lineEdit = new QLineEdit(m_minSearchPage); m_lineEdit->setMinimumSize(QSize(30, 26)); - m_lineEdit->setStyleSheet(QString::fromUtf8("border-radius: 13px; border:1px solid rgba(5, 151, 255, 1); background: transparent;")); + QString highLightColor = QString::number(m_lineEdit->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); m_lineEdit->setFrame(false); m_lineEdit->setPlaceholderText(tr("Search")); m_lineEdit->installEventFilter(this); @@ -519,7 +523,7 @@ void MainWindow::windowOption() void MainWindow::initUi() { qDebug() << "init UI"; - this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint); this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAutoFillBackground(false); this->setFocusPolicy(Qt::NoFocus); @@ -558,11 +562,10 @@ void MainWindow::initUi() m_dropDownMenu->addAction(m_letterAction); m_dropDownMenu->addAction(m_funcAction); m_allAction->setChecked(true); - m_collectPushButton->setStyleSheet("color:#3790FA;"); - QColor textColor = this->palette().color(QPalette::Text); - QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); - QString textColorDefault = "#" + QString::number(rgbDefault, 16); - m_recentPushButton->setStyleSheet(QString("color:%1;").arg(textColorDefault)); + QString textColorHightLight = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16).mid(2, 6); + m_collectPushButton->setStyleSheet(QString("color: #%1;").arg(textColorHightLight)); + QString textColorDefault = QString::number(this->palette().color(QPalette::Text).rgba(), 16).mid(2, 6); + m_recentPushButton->setStyleSheet(QString("color: #%1;").arg(textColorDefault)); QAction *action = new QAction(); action->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-icon-search.svg", true)); m_lineEdit->addAction(action, QLineEdit::LeadingPosition); @@ -1209,13 +1212,12 @@ void MainWindow::on_collectPushButton_clicked() { m_rightStackedWidget->setCurrentIndex(0); - m_collectPushButton->setStyleSheet("color:#3790FA;"); + QString textColorHightLight = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16).mid(2, 6); + m_collectPushButton->setStyleSheet(QString("color:#%1;").arg(textColorHightLight)); QFont collectFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize() + 2); m_collectPushButton->setFont(collectFont); - QColor textColor = this->palette().color(QPalette::Text); - QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); - QString textColorDefault = "#" + QString::number(rgbDefault, 16); - m_recentPushButton->setStyleSheet(QString("color:%1;").arg(textColorDefault)); + QString textColorDefault = QString::number(this->palette().color(QPalette::Text).rgba(), 16).mid(2, 6); + m_recentPushButton->setStyleSheet(QString("color:#%1;").arg(textColorDefault)); QFont recentFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize()); m_recentPushButton->setFont(recentFont); } @@ -1223,13 +1225,12 @@ void MainWindow::on_collectPushButton_clicked() void MainWindow::on_recentPushButton_clicked() { m_rightStackedWidget->setCurrentIndex(1); - QColor textColor = this->palette().color(QPalette::Text); - QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); - QString textColorDefault = "#" + QString::number(rgbDefault, 16); - m_collectPushButton->setStyleSheet(QString("color:%1").arg(textColorDefault)); + QString textColorDefault = QString::number(this->palette().color(QPalette::Text).rgba(), 16).mid(2, 6); + m_collectPushButton->setStyleSheet(QString("color:#%1").arg(textColorDefault)); QFont collectFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize()); m_collectPushButton->setFont(collectFont); - m_recentPushButton->setStyleSheet("color:#3790FA"); + QString textColorHightLight = QString::number(this->palette().color(QPalette::Highlight).rgba(), 16).mid(2, 6); + m_recentPushButton->setStyleSheet(QString("color:#%1").arg(textColorHightLight)); QFont recentFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize() + 2); m_recentPushButton->setFont(recentFont); -- Gitee From 89ad4de047f2a30862f5f79c5b184b5566486f2c Mon Sep 17 00:00:00 2001 From: lixueman Date: Wed, 20 Jul 2022 16:45:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?#130514,=E5=85=A8=E5=B1=8F=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E6=BB=91=E5=9D=97=E9=80=8F=E6=98=8E=E5=BA=A6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/Widget/full_commonuse_widget.cpp | 14 +++++++++----- src/UserInterface/Widget/full_function_widget.cpp | 14 +++++++++----- src/UserInterface/Widget/full_letter_widget.cpp | 14 +++++++++----- .../Widget/full_searchresult_widget.cpp | 14 +++++++++----- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/UserInterface/Widget/full_commonuse_widget.cpp b/src/UserInterface/Widget/full_commonuse_widget.cpp index c02f317..26d86b5 100755 --- a/src/UserInterface/Widget/full_commonuse_widget.cpp +++ b/src/UserInterface/Widget/full_commonuse_widget.cpp @@ -119,13 +119,13 @@ void FullCommonUseWidget::initVerticalScrollBar() m_verticalScrollBar->show(); } - m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, 1); " + m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, %4); " "margin: 0px,0px,0px,0px; border-radius: %3px;}" - "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, 1);" + "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, %5);" "border-radius: %3px; min-height: %1;}" "QScrollBar::add-line:vertical{ height: 0px; width: 0px; subcontrol-position: bottom;}" "QScrollBar::sub-line:vertical{ height: 0px; width: 0px; subcontrol-position:top;}").arg(scrollBarSize); - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); } void FullCommonUseWidget::on_powerOffButton_clicked() @@ -219,11 +219,15 @@ bool FullCommonUseWidget::eventFilter(QObject *watched, QEvent *event) if (watched == m_verticalScrollBar) { if (event->type() == QEvent::Enter) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.78)); } if (event->type() == QEvent::Leave) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); + } + + if(event->type() == QEvent::MouseButtonPress) { + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.9)); } } diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp index fd124e4..7cc8464 100755 --- a/src/UserInterface/Widget/full_function_widget.cpp +++ b/src/UserInterface/Widget/full_function_widget.cpp @@ -139,13 +139,13 @@ void FullFunctionWidget::initVerticalScrollBar() m_verticalScrollBar->show(); } - m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, 1); " + m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, %4); " "margin: 0px,0px,0px,0px; border-radius: %3px;}" - "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, 1);" + "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, %5);" "border-radius: %3px; min-height: %1;}" "QScrollBar::add-line:vertical{ height: 0px; width: 0px; subcontrol-position: bottom;}" "QScrollBar::sub-line:vertical{ height: 0px; width: 0px; subcontrol-position:top;}").arg(scrollBarSize); - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); } void FullFunctionWidget::on_powerOffButton_clicked() @@ -505,11 +505,15 @@ bool FullFunctionWidget::eventFilter(QObject *watched, QEvent *event) if (watched == m_verticalScrollBar) { if (watched == m_verticalScrollBar) { if (event->type() == QEvent::Enter) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.78)); } if (event->type() == QEvent::Leave) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); + } + + if(event->type() == QEvent::MouseButtonPress) { + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.9)); } } } else { diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index 45fb165..4b31a32 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -133,13 +133,13 @@ void FullLetterWidget::initVerticalScrollBar() m_verticalScrollBar->show(); } - m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, 1); " + m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, %4); " "margin: 0px,0px,0px,0px; border-radius: %3px;}" - "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, 1);" + "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, %5);" "border-radius: %3px; min-height: %1;}" "QScrollBar::add-line:vertical{ height: 0px; width: 0px; subcontrol-position: bottom;}" "QScrollBar::sub-line:vertical{ height: 0px; width: 0px; subcontrol-position:top;}").arg(scrollBarSize); - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); } void FullLetterWidget::on_powerOffButton_clicked() @@ -531,11 +531,15 @@ bool FullLetterWidget::eventFilter(QObject *watched, QEvent *event) { if (watched == m_verticalScrollBar) { if (event->type() == QEvent::Enter) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.78)); } if (event->type() == QEvent::Leave) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); + } + + if(event->type() == QEvent::MouseButtonPress) { + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.9)); } } else { if (event->type() == QEvent::KeyPress) { diff --git a/src/UserInterface/Widget/full_searchresult_widget.cpp b/src/UserInterface/Widget/full_searchresult_widget.cpp index be5dd6b..efdee49 100755 --- a/src/UserInterface/Widget/full_searchresult_widget.cpp +++ b/src/UserInterface/Widget/full_searchresult_widget.cpp @@ -108,13 +108,13 @@ void FullSearchResultWidget::initVerticalScrollBar() m_verticalScrollBar->show(); } - m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, 1); " + m_scrollBarStyle = QString("QScrollBar:vertical{width: %2px; background: rgba(12, 12, 12, %4); " "margin: 0px,0px,0px,0px; border-radius: %3px;}" - "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, 1);" + "QScrollBar::handle:vertical{width: %2px; background: rgba(255, 255, 255, %5);" "border-radius: %3px; min-height: %1;}" "QScrollBar::add-line:vertical{ height: 0px; width: 0px; subcontrol-position: bottom;}" "QScrollBar::sub-line:vertical{ height: 0px; width: 0px; subcontrol-position:top;}").arg(scrollBarSize); - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); } void FullSearchResultWidget::on_powerOffButton_clicked() @@ -204,11 +204,15 @@ bool FullSearchResultWidget::eventFilter(QObject *watched, QEvent *event) if (watched == m_verticalScrollBar) { if (event->type() == QEvent::Enter) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.78)); } if (event->type() == QEvent::Leave) { - m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2)); + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(4).arg(2).arg(0.25).arg(0.6)); + } + + if(event->type() == QEvent::MouseButtonPress) { + m_verticalScrollBar->setStyleSheet(m_scrollBarStyle.arg(8).arg(4).arg(0.25).arg(0.9)); } } -- Gitee From e9d7c5ac2daa5a7499475c989bc9f61606533981 Mon Sep 17 00:00:00 2001 From: lixueman Date: Thu, 21 Jul 2022 11:31:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?#130485=20#130477,=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AD=97=E6=AF=8D/=E5=8A=9F=E8=83=BD=E9=9B=86=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E9=A1=B5=EF=BC=8C=E7=A6=81=E7=94=A8=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Button/function_classify_button.cpp | 83 ++++++++----------- .../Button/function_classify_button.h | 3 - .../Button/letter_classify_button.cpp | 55 +++++++++--- .../Button/letter_classify_button.h | 2 +- .../Widget/full_letter_widget.cpp | 2 +- .../Widget/function_button_widget.cpp | 6 +- .../Widget/letter_button_widget.cpp | 6 +- 7 files changed, 83 insertions(+), 74 deletions(-) diff --git a/src/UserInterface/Button/function_classify_button.cpp b/src/UserInterface/Button/function_classify_button.cpp index 2494be4..8ddabe1 100755 --- a/src/UserInterface/Button/function_classify_button.cpp +++ b/src/UserInterface/Button/function_classify_button.cpp @@ -36,23 +36,11 @@ FunctionClassifyButton::FunctionClassifyButton(int width, m_iconSize(iconSize), m_category(category), m_fullscreen(fullscreen), - m_enabled(enabled), - m_iconLabel(new QLabel), - m_textLabel(new QLabel) + m_enabled(enabled) { this->setFlat(true); this->setFixedSize(m_width, m_height); this->setFocusPolicy(Qt::NoFocus); - m_iconLabel->setFixedSize(m_iconSize, m_iconSize); - m_textLabel->adjustSize(); - m_textLabel->setText(m_category); - m_textLabel->setAlignment(Qt::AlignCenter); - - if (m_fullscreen) { - QPalette pe = m_textLabel->palette(); - pe.setColor(QPalette::ButtonText, Qt::white); - m_textLabel->setPalette(pe); - } if (m_fullscreen) { updateIconState(Normal); @@ -67,12 +55,6 @@ FunctionClassifyButton::FunctionClassifyButton(int width, this->setCheckable(false); } - QHBoxLayout *mainlayout = new QHBoxLayout; - mainlayout->setContentsMargins(0, 0, 0, 0); - mainlayout->setSpacing(Style::LeftSpaceIconText); - this->setLayout(mainlayout); -// mainlayout->addWidget(m_iconLabel); - mainlayout->addWidget(m_textLabel); connect(this, &FunctionClassifyButton::toggled, this, &FunctionClassifyButton::reactToToggle); connect(this, &FunctionClassifyButton::clicked, this, &FunctionClassifyButton::buttonClickedSlot); } @@ -115,6 +97,37 @@ void FunctionClassifyButton::paintEvent(QPaintEvent *e) painter.restore(); } + if (!(option.state & QStyle::State_Enabled)) { + painter.save(); + QColor color; + if (!m_fullscreen) { + if ( g_curStyle == "ukui-light") { + color = Qt::black; + } else { + color = Qt::white; + } + color.setAlphaF(0.2); + } + painter.setPen(color); + painter.drawText(option.rect, Qt::AlignCenter, m_category); + painter.restore(); + } + + if (option.state & QStyle::State_Enabled) { + painter.save(); + QColor color; + + 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); + painter.restore(); + } + if (m_fullscreen && (option.state & QStyle::State_On)) { painter.save(); painter.setPen(Qt::NoPen); @@ -265,37 +278,7 @@ void FunctionClassifyButton::updateIconState(const FunctionClassifyButton::State // } // pixmap.setDevicePixelRatio(qApp->devicePixelRatio()); // m_iconLabel->setPixmap(pixmap); - updateTextState(state); +// updateTextState(state); } -void FunctionClassifyButton::updateTextState(const FunctionClassifyButton::State state) -{ - // QPalette p= m_textLabel->palette(); - switch (state) { - case Enabled: - // p.setColor(QPalette::WindowText,QColor::fromRgbF(1, 1, 1)); - // m_textLabel->setStyleSheet("background:transparent; color:rgba(255, 255, 255);"); - break; - - case Disabled: - // p.setColor(QPalette::WindowText,QColor::fromRgbF(1, 1, 1, 0.25)); - // m_textLabel->setStyleSheet("background:transparent; color:rgba(255, 255, 255, 25%);"); - break; - - case Normal: - // p.setColor(QPalette::WindowText,QColor::fromRgbF(1, 1, 1, 0.50)); - // m_textLabel->setStyleSheet("background:transparent; color:rgba(255, 255, 255, 50%);"); - break; - case Checked: - // p.setColor(QPalette::WindowText,QColor::fromRgbF(1, 1, 1)); - // m_textLabel->setStyleSheet("background:transparent;color:rgba(255, 255, 255);"); - break; - - default: - break; - } - - // p.setColor(QPalette::Window,Qt::transparent); - // m_textLabel->setPalette(p); -} diff --git a/src/UserInterface/Button/function_classify_button.h b/src/UserInterface/Button/function_classify_button.h index e99f2c3..6160fb9 100755 --- a/src/UserInterface/Button/function_classify_button.h +++ b/src/UserInterface/Button/function_classify_button.h @@ -58,8 +58,6 @@ public: QString m_category; bool m_fullscreen; bool m_enabled; - QLabel *m_iconLabel = nullptr; - QLabel *m_textLabel = nullptr; State m_state = Checked; void updateBtnState(); @@ -70,7 +68,6 @@ protected: void leaveEvent(QEvent *e); void paintEvent(QPaintEvent *e); void updateIconState(const State state); - void updateTextState(const State state); Q_SIGNALS: void buttonClicked(); diff --git a/src/UserInterface/Button/letter_classify_button.cpp b/src/UserInterface/Button/letter_classify_button.cpp index 5bc882f..624c38e 100755 --- a/src/UserInterface/Button/letter_classify_button.cpp +++ b/src/UserInterface/Button/letter_classify_button.cpp @@ -28,17 +28,17 @@ LetterClassifyButton::LetterClassifyButton(QWidget *parent, m_fullscreen(fullscreen) { this->setFlat(true); - - if (m_fullscreen) { - QFont font; - font.setPixelSize(Style::LeftLetterFontSize); - this->setFont(font); - QPalette pe = this->palette(); - pe.setColor(QPalette::ButtonText, Qt::white); - this->setPalette(pe); - } - - this->setText(letter); + m_letter = letter; +// if (m_fullscreen) { +// QFont font; +// font.setPixelSize(Style::LeftLetterFontSize); +// this->setFont(font); +// QPalette pe = this->palette(); +// pe.setColor(QPalette::ButtonText, Qt::white); +// this->setPalette(pe); +// } + +// this->setText(letter); this->setFocusPolicy(Qt::NoFocus); this->setCheckable(true); this->setStyleSheet("padding: 0px;"); @@ -82,6 +82,37 @@ void LetterClassifyButton::paintEvent(QPaintEvent *e) painter.restore(); } + if (!(option.state & QStyle::State_Enabled)) { + painter.save(); + QColor color; + if (!m_fullscreen) { + if ( g_curStyle == "ukui-light") { + color = Qt::black; + } else { + color = Qt::white; + } + color.setAlphaF(0.2); + } + painter.setPen(color); + painter.drawText(option.rect, Qt::AlignCenter, m_letter); + painter.restore(); + } + + if (option.state & QStyle::State_Enabled) { + painter.save(); + QColor color; + + 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); + painter.restore(); + } + if (m_fullscreen && (option.state & QStyle::State_On)) { painter.save(); painter.setPen(Qt::NoPen); @@ -118,7 +149,7 @@ void LetterClassifyButton::enterEvent(QEvent *e) // this->setFixedSize(Style::LeftLetterBtnHeight*2,Style::LeftLetterBtnHeight*2); tooltip = new LetterToolTip(); QPoint oPoint = this->mapToGlobal(QPoint(this->rect().x() + 35, this->rect().y() - 10)); - tooltip->setText(this->text()); + tooltip->setText(m_letter); tooltip->raise(); tooltip->move(oPoint); tooltip->show(); diff --git a/src/UserInterface/Button/letter_classify_button.h b/src/UserInterface/Button/letter_classify_button.h index b6b2a3d..7235987 100755 --- a/src/UserInterface/Button/letter_classify_button.h +++ b/src/UserInterface/Button/letter_classify_button.h @@ -35,7 +35,7 @@ public: ); bool is_pressed = false; - + QString m_letter = QString(); private: bool m_fullscreen = false; LetterToolTip *tooltip = nullptr; diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index 4b31a32..1ebc2c5 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -379,7 +379,7 @@ void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn) if (m_btnGroup->id(btn) == m_buttonList.indexOf(button)) { letterbtn->setChecked(true); //此处需实现将被选定的字母包含的应用列表移动到applistWid界面最顶端 - QString letterstr = letterbtn->text(); + QString letterstr = letterbtn->m_letter; int num = m_letterList.indexOf(letterstr); if (num != -1) { diff --git a/src/UserInterface/Widget/function_button_widget.cpp b/src/UserInterface/Widget/function_button_widget.cpp index cd7b8f8..dbb116c 100755 --- a/src/UserInterface/Widget/function_button_widget.cpp +++ b/src/UserInterface/Widget/function_button_widget.cpp @@ -76,7 +76,7 @@ void FunctionButtonWidget::initUi() Q_FOREACH (QAbstractButton *btn, m_buttonList) { FunctionClassifyButton *fbtn = qobject_cast(btn); - fbtn->updateIconState(); + fbtn->updateBtnState(); } }); } @@ -88,9 +88,7 @@ void FunctionButtonWidget::initUi() void FunctionButtonWidget::functionBtnClickedSlot() { FunctionClassifyButton *btn = dynamic_cast(sender()); - QWidget *wid = btn->layout()->itemAt(0)->widget(); - QLabel *label = qobject_cast(wid); - Q_EMIT sendFunctionBtnSignal(label->text()); + Q_EMIT sendFunctionBtnSignal(btn->m_category); } void FunctionButtonWidget::hideEvent(QHideEvent *event) diff --git a/src/UserInterface/Widget/letter_button_widget.cpp b/src/UserInterface/Widget/letter_button_widget.cpp index 68e3a74..f110340 100755 --- a/src/UserInterface/Widget/letter_button_widget.cpp +++ b/src/UserInterface/Widget/letter_button_widget.cpp @@ -47,7 +47,7 @@ void LetterButtonWidget::initUi() letterlist.append(QString(QChar(letter))); } - letterlist.append("&&"); + letterlist.append("&"); letterlist.append("#"); for (int row = 0; row < 6; row++) { @@ -78,7 +78,7 @@ void LetterButtonWidget::hideEvent(QHideEvent *event) void LetterButtonWidget::letterBtnClickedSlot() { LetterClassifyButton *btn = dynamic_cast(QObject::sender()); - QString btnname = btn->text(); + QString btnname = btn->m_letter; Q_EMIT sendLetterBtnSignal(btnname); } @@ -93,7 +93,7 @@ void LetterButtonWidget::recvLetterBtnList(QStringList list) for (int col = 0; col < 4; col++) { QLayoutItem *item = gridLayout->itemAt(row * 4 + col); LetterClassifyButton *btn = static_cast(item->widget()); - QString letterstr = btn->text(); + QString letterstr = btn->m_letter; if (list.indexOf(letterstr.at(0)) == -1) { btn->setEnabled(false); -- Gitee From 681e05b0ae6d9aa3d968c733c88bdb636776c7fe Mon Sep 17 00:00:00 2001 From: lixueman Date: Thu, 21 Jul 2022 14:00:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9changelog=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index ac0c955..d417da0 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ukui-menu (3.1.1-ok4~0721) yangtze; urgency=medium + + * close-cd #130526 修改搜索框和收藏最近按钮高亮色 + * close-cd #130514 全屏菜单的滑块透明度修改 + * close-cd #130485 修改字母集导航页禁用按钮样式 + * close-cd #130477 修改功能集导航页禁用按钮样式 + + -- kylin Thu, 21 Jul 2022 13:51:42 +0800 + ukui-menu (3.1.1-ok4~0718) yangtze; urgency=medium * close-cd #127740 修复wayland下默认全屏切换动画位置异常,不显示动画 -- Gitee