From b6da22b85e0961df8796cf602aa6ec53e526d04e Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Thu, 17 Dec 2020 17:09:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=93=9D=E7=89=99=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=9C=AA=E5=8F=8A=E6=97=B6=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当开机时连接蓝牙设备,重启过程中关闭已连接的蓝牙设备,在特定机型上开机时,蓝牙的状态为 StateAvailable (这个状态的意思是识别的蓝牙设备可以连接,但未连接成功的状态, 可能出现的情况:蓝牙信号不好,意外断开连接或连接不上;蓝牙设备将配对信息删除,导致本机连不上蓝牙设备), 原来的代码中没有在 StateAvailable 状态更新图标(目的是因为当有多个蓝牙设备连接,其中一台因为上述原因断开连接时,不去更新蓝牙图标状态,只有在没有设备连接的情况下, 状态才会变为 StateUnavailable,更新图标为灰色)。如果不在一开始更新一下图标,就会导致开机时是 StateAvailable 状态,不刷新图标,显示默认的蓝色蓝牙图标。 故在初始化的时候先刷新一遍图标,如果后面状态有变化再触发更新蓝牙图标状态。 Log: 修复蓝牙图标未及时刷新的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-58253.html Change-Id: I511e541b86b713fdc353793ff042d7abc5ec3414 --- plugins/bluetooth/bluetoothitem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index 07c1ab0c0..061905698 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -45,9 +45,12 @@ BluetoothItem::BluetoothItem(QWidget *parent) : QWidget(parent) , m_tipsLabel(new TipsWidget(this)) , m_applet(new BluetoothApplet(this)) + , m_devState(Device::State::StateUnavailable) + , m_adapterPowered(m_applet->poweredInitState()) { m_applet->setVisible(false); - m_adapterPowered = m_applet->poweredInitState(); + m_tipsLabel->setVisible(false); + refreshIcon(); connect(m_applet, &BluetoothApplet::powerChanged, [&](bool powered) { m_adapterPowered = powered;