mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +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;
|
break;
|
||||||
case Connected: {
|
case Connected: {
|
||||||
QString strTips;
|
QString strTips;
|
||||||
|
QStringList textList;
|
||||||
for (auto wirelessItem : m_connectedWirelessDevice) {
|
for (auto wirelessItem : m_connectedWirelessDevice) {
|
||||||
if (wirelessItem) {
|
if (wirelessItem) {
|
||||||
auto info = wirelessItem->getActiveWirelessConnectionInfo();
|
auto info = wirelessItem->getActiveWirelessConnectionInfo();
|
||||||
@ -1149,6 +1150,8 @@ void NetworkItem::refreshTips()
|
|||||||
if (!ipv4.contains("Address"))
|
if (!ipv4.contains("Address"))
|
||||||
break;
|
break;
|
||||||
strTips = tr("Wireless connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
strTips = tr("Wireless connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||||
|
strTips.chop(1);
|
||||||
|
textList << strTips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto wiredItem : m_connectedWiredDevice) {
|
for (auto wiredItem : m_connectedWiredDevice) {
|
||||||
@ -1160,10 +1163,11 @@ void NetworkItem::refreshTips()
|
|||||||
if (!ipv4.contains("Address"))
|
if (!ipv4.contains("Address"))
|
||||||
break;
|
break;
|
||||||
strTips = tr("Wired connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
strTips = tr("Wired connection: %1").arg(ipv4.value("Address").toString()) + '\n';
|
||||||
|
strTips.chop(1);
|
||||||
|
textList << strTips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strTips.chop(1);
|
m_tipsWidget->setTextList(textList);
|
||||||
m_tipsWidget->setText(strTips);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Aconnected: {
|
case Aconnected: {
|
||||||
|
@ -82,11 +82,24 @@ void TipsWidget::paintEvent(QPaintEvent *event)
|
|||||||
bool TipsWidget::event(QEvent *event)
|
bool TipsWidget::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FontChange) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
if (!m_text.trimmed().isEmpty()) {
|
if (m_type == SingleLine) {
|
||||||
setFixedSize(fontMetrics().width(m_text) + 6, fontMetrics().height());
|
if (!m_text.trimmed().isEmpty()) {
|
||||||
update();
|
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);
|
return QFrame::event(event);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user