Merge branch 'yhkylin/v101-fork' into 'yhkylin/v101'

解决BUG 148868, 【控制面板-网络】移动热点连接设备列表条目文字显示未居中,下边缘为直角

See merge request kylinos-src/kylin-nm!79
This commit is contained in:
赵世旭 2023-01-16 07:21:16 +00:00
commit 41ff76061f
4 changed files with 33 additions and 29 deletions

View File

@ -34,12 +34,12 @@ BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
Vlayout->setContentsMargins(CONTENTS_MARGINS);
Vlayout->setSpacing(0);
QFrame *blacklistFrame = new QFrame(this);
blacklistFrame->setMinimumSize(FRAME_MIN_SIZE);
blacklistFrame->setMaximumSize(FRAME_MAX_SIZE);
blacklistFrame->setFrameShape(QFrame::Box);
m_blacklistFrame = new QFrame(this);
m_blacklistFrame->setMinimumSize(FRAME_MIN_SIZE);
m_blacklistFrame->setMaximumSize(FRAME_MAX_SIZE);
m_blacklistFrame->setFrameShape(QFrame::Box);
m_blacklistLayout = new QVBoxLayout(blacklistFrame);
m_blacklistLayout = new QVBoxLayout(m_blacklistFrame);
m_blacklistLayout->setContentsMargins(0, 0, 0, 0);
m_blacklistLayout->setSpacing(0);
@ -48,7 +48,7 @@ BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
Vlayout->addWidget(m_titleLabel);
Vlayout->addSpacing(8);
Vlayout->addWidget(blacklistFrame);
Vlayout->addWidget(m_blacklistFrame);
}
QFrame* BlacklistPage::myLine()
@ -87,7 +87,7 @@ void BlacklistPage::getBlacklistDevice(QMap<QString, QString> &blacklistMap)
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
QString macTemp = macList.at(index);
macTemp = macTemp.trimmed();
if (!blacklistMap.contains(macTemp)) {
if (!blacklistMap.contains(macTemp) && hostNameList.at(index) != nullptr) {
blacklistMap[macTemp] = hostNameList.at(index);
}
}
@ -166,7 +166,7 @@ void BlacklistPage::resetLayoutHight()
height += w->height();
}
}
this->setFixedHeight(height + m_titleLabel->height() + 8);
m_blacklistFrame->setFixedHeight(height);
if (m_blacklistMap.isEmpty()) {
this->hide();

View File

@ -49,15 +49,8 @@ public:
}
private:
QFrame* myLine();
TitleLabel *m_titleLabel = nullptr;
QVBoxLayout *m_blacklistLayout = nullptr;
QMap<QString, QString> m_blacklistMap;
QDBusInterface *m_settingPathInterface = nullptr;
void getBlacklistDevice(QMap<QString, QString> &blacklistMap);
bool removeStaFromBlacklist(QString staMac, QString staName);
void initBlacklistDev();
@ -65,6 +58,14 @@ private:
void clearBlacklistLayout();
void resetLayoutHight();
private:
QFrame *m_blacklistFrame = nullptr;
TitleLabel *m_titleLabel = nullptr;
QVBoxLayout *m_blacklistLayout = nullptr;
QMap<QString, QString> m_blacklistMap;
QDBusInterface *m_settingPathInterface = nullptr;
private slots:
void onsetStaIntoBlacklist(QString staMac, QString staName);
void onRemoveFromBlacklistBtnClicked(QString staMac, QString staName);

View File

@ -35,12 +35,12 @@ ConnectdevPage::ConnectdevPage(QWidget *parent) :
Vlayout->setContentsMargins(CONTENTS_MARGINS);
Vlayout->setSpacing(0);
QFrame *staistFrame = new QFrame(this);
staistFrame->setMinimumSize(FRAME_MIN_SIZE);
staistFrame->setMaximumSize(FRAME_MAX_SIZE);
staistFrame->setFrameShape(QFrame::Box);
m_staistFrame = new QFrame(this);
m_staistFrame->setMinimumSize(FRAME_MIN_SIZE);
m_staistFrame->setMaximumSize(FRAME_MAX_SIZE);
m_staistFrame->setFrameShape(QFrame::Box);
m_staListLayout = new QVBoxLayout(staistFrame);
m_staListLayout = new QVBoxLayout(m_staistFrame);
m_staListLayout->setContentsMargins(0, 0, 0, 0);
m_staListLayout->setSpacing(0);
@ -49,7 +49,7 @@ ConnectdevPage::ConnectdevPage(QWidget *parent) :
Vlayout->addWidget(m_titleLabel);
Vlayout->addSpacing(8);
Vlayout->addWidget(staistFrame);
Vlayout->addWidget(m_staistFrame);
}
QFrame* ConnectdevPage::myLine()
@ -90,7 +90,7 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
QStringList macList = reply.arguments().at(0).toString().split(";");
QStringList hostNameList = reply.arguments().at(1).toString().split(";");
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
if (!staMap.contains(macList.at(index))) {
if (!staMap.contains(macList.at(index)) && hostNameList.at(index) != nullptr) {
staMap[macList.at(index)] = hostNameList.at(index);
}
}
@ -158,7 +158,7 @@ void ConnectdevPage::resetLayoutHight()
height += w->height();
}
}
this->setFixedHeight(height + m_titleLabel->height() + 8);
m_staistFrame->setFixedHeight(height);
if (m_staMap.isEmpty()) {
this->hide();

View File

@ -50,12 +50,6 @@ public:
private:
QFrame* myLine();
TitleLabel *m_titleLabel = nullptr;
QVBoxLayout *m_staListLayout = nullptr;
QMap<QString, QString> m_staMap;
QDBusInterface *m_activePathInterface = nullptr;
void getConnectStaDevice(QMap<QString, QString> &blacklistMap);
bool removeStaFromBlacklist(QString staMac);
void initStaDev();
@ -67,6 +61,15 @@ private:
void onStaDevChanged(bool istrue, QString staMac, QString staName);
void resetLayoutHight();
private:
QFrame *m_staistFrame = nullptr;
TitleLabel *m_titleLabel = nullptr;
QVBoxLayout *m_staListLayout = nullptr;
QMap<QString, QString> m_staMap;
QDBusInterface *m_activePathInterface = nullptr;
signals:
void setStaIntoBlacklist(QString staMac, QString staName);