From beb13fc33d5b39f157dffdf97120ba0753071312 Mon Sep 17 00:00:00 2001 From: Jokul Date: Sun, 9 Aug 2026 07:41:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E7=BD=91=E5=8D=A1?= =?UTF-8?q?=E5=90=8E=E4=BC=9A=E8=AF=9D=E6=B5=81=E9=87=8F=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setActiveInterface 重置会话总量 m_totalDownload/m_totalUpload 为 0, 与包统计重置逻辑一致,切换后显示当前网卡的会话流量 --- src/networkmonitorapplet.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/networkmonitorapplet.cpp b/src/networkmonitorapplet.cpp index 56010ec..ea8952f 100644 --- a/src/networkmonitorapplet.cpp +++ b/src/networkmonitorapplet.cpp @@ -368,6 +368,13 @@ void NetworkMonitorApplet::setActiveInterface(const QString &interface) m_txDropped = 0; emit packetStatsChanged(); + // 接口切换后会话总量重置为 0,重新累加当前网卡流量 + // 设计原因:用户期望切换后显示当前网卡的会话流量,而非所有网卡总和; + // 与包统计的重置逻辑一致,切换后各统计项都归零重新计算 + m_totalDownload = 0; + m_totalUpload = 0; + emit totalChanged(); + // 持久化到配置文件,下次启动自动加载用户选择的网卡 // 设计原因:弹窗 chip 和设置窗口都调用此方法,统一持久化保证两处选择一致 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)