mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix(network): 同时连接有线网络和无线网络时,只显示了有线网络的IP
功能缺失,修改代码添加当有线网络和无线网络同时连接的时候,显示所有的网络IP Log: 解决同时连接有线网络和无线网络时,只显示了有线网络的IP问题 Bug: https://pms.uniontech.com/zentao/bug-view-35197.html
This commit is contained in:
parent
44af20205a
commit
356473fd53
@ -1140,6 +1140,7 @@ void NetworkItem::refreshTips()
|
||||
break;
|
||||
case Connected: {
|
||||
QString strTips;
|
||||
QStringList textList;
|
||||
for (auto wirelessItem : m_connectedWirelessDevice) {
|
||||
if (wirelessItem) {
|
||||
auto info = wirelessItem->getActiveWirelessConnectionInfo();
|
||||
@ -1149,6 +1150,8 @@ void NetworkItem::refreshTips()
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
strTips = tr("Wireless connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
strTips.chop(1);
|
||||
textList << strTips;
|
||||
}
|
||||
}
|
||||
for (auto wiredItem : m_connectedWiredDevice) {
|
||||
@ -1160,10 +1163,11 @@ void NetworkItem::refreshTips()
|
||||
if (!ipv4.contains("Address"))
|
||||
break;
|
||||
strTips = tr("Wired connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||
strTips.chop(1);
|
||||
textList << strTips;
|
||||
}
|
||||
}
|
||||
strTips.chop(1);
|
||||
m_tipsWidget->setText(strTips);
|
||||
m_tipsWidget->setTextList(textList);
|
||||
}
|
||||
break;
|
||||
case Aconnected: {
|
||||
|
@ -82,11 +82,24 @@ void TipsWidget::paintEvent(QPaintEvent *event)
|
||||
bool TipsWidget::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FontChange) {
|
||||
if (!m_text.trimmed().isEmpty()) {
|
||||
setFixedSize(fontMetrics().width(m_text) + 6, fontMetrics().height());
|
||||
update();
|
||||
if (m_type == SingleLine) {
|
||||
if (!m_text.trimmed().isEmpty()) {
|
||||
setFixedSize(fontMetrics().width(m_text) + 6, fontMetrics().height());
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
if (m_textList.size() > 0) {
|
||||
int maxLength = 0;
|
||||
setFixedHeight(fontMetrics().height() * m_textList.size());
|
||||
for (QString text : m_textList) {
|
||||
int fontLength = fontMetrics().width(text) + 6;
|
||||
maxLength = qMax(maxLength,fontLength);
|
||||
}
|
||||
m_width = maxLength;
|
||||
setFixedWidth(maxLength);
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QFrame::event(event);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user