From 259aadfbf65bebdcb4aa0bf19675fb3475f584ca Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Fri, 22 Sep 2023 18:08:09 +0800 Subject: [PATCH] =?UTF-8?q?pref(ui):=20=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=89=98=E7=9B=98=E6=97=A0=E7=BA=BF=E5=AF=86=E7=A0=81=E6=A1=86?= =?UTF-8?q?=E8=89=B2=E6=9D=BF=EF=BC=8C=E8=A6=86=E7=9B=96KPasswordEdit?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=89=B2=E6=9D=BF(bug#191685)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/list-items/wlanlistitem.cpp | 13 ++++++++++++- src/frontend/list-items/wlanlistitem.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 091ee32a..fe894181 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -254,6 +254,18 @@ void WlanListItem::keyPressEvent(QKeyEvent *event) return QFrame::keyPressEvent(event); } +void WlanListItem::paintEvent(QPaintEvent *event) +{ + QPalette pal = this->palette(); + if (m_pwdLineEdit != nullptr) { + pal.setColor(QPalette::Base, pal.color(QPalette::Base)); + pal.setColor(QPalette::Text, pal.color(QPalette::Text)); + m_pwdLineEdit->setPalette(pal); + } + + return QWidget::paintEvent(event); +} + void WlanListItem::initWlanUI() { m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true; @@ -281,7 +293,6 @@ void WlanListItem::initWlanUI() m_pwdLineEdit = new KPasswordEdit(m_pwdFrame); m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); m_pwdLineEdit->setProperty("needTranslucent", true); -// m_pwdLineEdit->setUseCustomPalette(true); m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮 m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); //打开输入法 // m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index ab28e729..d5443ee9 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -90,6 +90,7 @@ protected: void leaveEvent(QEvent *event); bool eventFilter(QObject *watched, QEvent *event); void keyPressEvent(QKeyEvent *event); + void paintEvent(QPaintEvent *event); Q_SIGNALS: void itemHeightChanged(const bool isExpanded, const QString &ssid);