Merge branch 'jxj' into 'dbus-interface'

详情页UI

See merge request kylin-desktop/kylin-nm!445
This commit is contained in:
ren peijia 2021-12-03 03:09:20 +00:00
commit 4f2776fb4f
2 changed files with 24 additions and 0 deletions

View File

@ -2,6 +2,9 @@
#define CONINFO_H #define CONINFO_H
#include <QString> #include <QString>
#include <QPalette>
#include <QComboBox>
#include <QAbstractItemView>
#include "kywirelessnetitem.h" #include "kywirelessnetitem.h"
#include "kylinconnectresource.h" #include "kylinconnectresource.h"
#include "kylinactiveconnectresource.h" #include "kylinactiveconnectresource.h"
@ -72,4 +75,19 @@ static void setLineEditMenuPolicy(QFrame *widget) {
lineEditList.at(i)->setContextMenuPolicy(Qt::NoContextMenu); lineEditList.at(i)->setContextMenuPolicy(Qt::NoContextMenu);
} }
} }
static void setFramePalette(QFrame *widget, QPalette &pal) {
QList<QLineEdit *> lineEditList = widget->findChildren<QLineEdit *>();
for (int i = 0; i < lineEditList.count(); ++i) {
lineEditList.at(i)->setPalette(pal);
}
QList<QComboBox *> comboBoxList = widget->findChildren<QComboBox *>();
for (int i = 0; i < comboBoxList.count(); ++i) {
comboBoxList.at(i)->setPalette(pal);
if (comboBoxList.at(i)->view()) {
comboBoxList.at(i)->view()->setPalette(pal);
}
}
}
#endif // CONINFO_H #endif // CONINFO_H

View File

@ -120,6 +120,12 @@ void NetDetail::onPaletteChanged()
this->setPalette(pal); this->setPalette(pal);
setFramePalette(detailPage, pal);
setFramePalette(ipv4Page, pal);
setFramePalette(ipv6Page, pal);
setFramePalette(securityPage, pal);
setFramePalette(createNetPage, pal);
QPalette listwidget_pal(detailPage->m_listWidget->palette()); QPalette listwidget_pal(detailPage->m_listWidget->palette());
listwidget_pal.setColor(QPalette::Base, this->palette().base().color()); listwidget_pal.setColor(QPalette::Base, this->palette().base().color());
listwidget_pal.setColor(QPalette::AlternateBase, this->palette().alternateBase().color()); listwidget_pal.setColor(QPalette::AlternateBase, this->palette().alternateBase().color());