Merge branch '2309-0922pm' into 'yhkylin/v101'

pref(ui): 自定义托盘无线密码框色板,覆盖KPasswordEdit默认色板(bug#191685)

See merge request kylinos-src/kylin-nm!273
This commit is contained in:
赵世旭 2023-09-26 06:49:06 +00:00
commit c844a3b539
2 changed files with 13 additions and 1 deletions

View File

@ -254,6 +254,18 @@ void WlanListItem::keyPressEvent(QKeyEvent *event)
return QFrame::keyPressEvent(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() void WlanListItem::initWlanUI()
{ {
m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true; 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 = new KPasswordEdit(m_pwdFrame);
m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH);
m_pwdLineEdit->setProperty("needTranslucent", true); m_pwdLineEdit->setProperty("needTranslucent", true);
// m_pwdLineEdit->setUseCustomPalette(true);
m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮 m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮
m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); //打开输入法 m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); //打开输入法
// m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); // m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false);

View File

@ -90,6 +90,7 @@ protected:
void leaveEvent(QEvent *event); void leaveEvent(QEvent *event);
bool eventFilter(QObject *watched, QEvent *event); bool eventFilter(QObject *watched, QEvent *event);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
Q_SIGNALS: Q_SIGNALS:
void itemHeightChanged(const bool isExpanded, const QString &ssid); void itemHeightChanged(const bool isExpanded, const QString &ssid);