fix: 修复移除蓝牙后弹框依然显示的问题

移除设备后弹窗不再显示

Log:
Influence: 点击任务栏的蓝牙图标,弹出蓝牙弹窗,然后移除蓝牙,观察蓝牙的弹窗是否存在
Bug: https://pms.uniontech.com/bug-view-181945.html
Change-Id: Idcef18077d9f822b2ea3aca93442a2d098ea146b
This commit is contained in:
donghualin 2023-01-12 10:58:43 +08:00
parent a1748e3ca1
commit f7812cfb66
4 changed files with 15 additions and 0 deletions

View File

@ -89,6 +89,12 @@ void DockPopupWindow::setContent(QWidget *content)
void DockPopupWindow::setExtendWidget(QWidget *widget)
{
m_extendWidget = widget;
connect(widget, &QWidget::destroyed, this, [ this ] { m_extendWidget = nullptr; }, Qt::UniqueConnection);
}
QWidget *DockPopupWindow::extengWidget() const
{
return m_extendWidget;
}
void DockPopupWindow::show(const QPoint &pos, const bool model)

View File

@ -45,6 +45,7 @@ public:
void setContent(QWidget *content);
void setExtendWidget(QWidget *widget);
QWidget *extengWidget() const;
public slots:
void show(const QPoint &pos, const bool model = false);

View File

@ -359,6 +359,12 @@ void QuickPluginWindow::onRequestUpdate()
// 如果该插件在任务栏上,则先将其添加到临时列表中
pluginItems[dockItem->pluginItem()] = dockItem;
} else {
DockPopupWindow *popupWindow = getPopWindow();
if (popupWindow->isVisible()) {
// 该插件被移除的情况下,判断弹出窗口是否在当前的插件中打开的,如果是,则隐藏该窗口
if (popupWindow->extengWidget() == dockItem)
popupWindow->hide();
}
// 如果该插件不在任务栏上,则先删除
dockItem->deleteLater();
countChanged = true;

View File

@ -64,6 +64,8 @@ void BluetoothPlugin::init(PluginProxyInterface *proxyInter)
m_proxyInter->itemAdded(this, BLUETOOTH_KEY);
});
connect(m_bluetoothItem.data(), &BluetoothItem::noAdapter, [&] {
m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, false);
m_proxyInter->requestSetAppletVisible(this, BLUETOOTH_KEY, false);
m_proxyInter->itemRemoved(this, BLUETOOTH_KEY);
});
connect(m_bluetoothWidget.data(), &BluetoothMainWidget::requestExpand, this, [ = ] {