From 9acd608ed47420f9cf68e2bb21193ba383735009 Mon Sep 17 00:00:00 2001 From: dengbo Date: Wed, 16 Nov 2022 21:31:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=82=B9=E5=87=BB=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E8=93=9D=E7=89=99=E8=AE=BE=E7=BD=AE=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=94=A4=E8=B5=B7=E6=8E=A7=E5=88=B6=E4=B8=AD?= =?UTF-8?q?=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当开启飞行模式后,只禁用(置灰)蓝牙适配器列表一栏,而不是置灰整个蓝牙面板 Log: 修复点击任务栏蓝牙设置不能正常唤起控制中心的问题 Bug: https://pms.uniontech.com/bug-view-171999.html Influence: 任务栏蓝牙面板正常显示/正常使用 Change-Id: Ib1549cf28736ce2dc780b9b0427a7a472dbd4ab8 --- plugins/bluetooth/componments/bluetoothapplet.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp index 7066bf285..9cb9f7c64 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.cpp +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -173,6 +173,11 @@ void BluetoothApplet::onAdapterAdded(Adapter *adapter) m_adapterItems.insert(adapter->id(), adapterItem); + // 如果开启了飞行模式,置灰蓝牙适配器使能开关 + foreach (const auto item, m_adapterItems) { + item->setEnabled(!m_airPlaneModeInter->enabled()); + } + m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter); updateBluetoothPowerState(); updateSize(); @@ -247,7 +252,6 @@ void BluetoothApplet::initUi() updateSize(); setAirplaneModeEnabled(m_airPlaneModeInter->enabled()); - setDisabled(m_airPlaneModeInter->enabled()); } void BluetoothApplet::initConnect() @@ -266,7 +270,11 @@ void BluetoothApplet::initConnect() }); connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme); connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setAirplaneModeEnabled); - connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setDisabled); + connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, [this](bool enabled) { + foreach (const auto item, m_adapterItems) { + item->setEnabled(!enabled); + } + }); } /**