fix: 修复不同托盘插件内容重叠显示的问题

插件提供的弹出界面可能未设置其visible为false,导致创建后就指定了父对象
当其他插件显示后,此插件内容也随之显示

Log: 修复插件内容概率性重叠显示的问题
Influence: 托盘插件内容显示
Task: https://pms.uniontech.com/zentao/task-view-97417.html
Change-Id: I6f4f06e4f624409203f8ea61589754f555f17338
This commit is contained in:
范朋程 2022-01-10 10:00:14 +08:00
parent 6586c84b90
commit a683cab1aa

View File

@ -72,6 +72,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS
// 必须初始化父窗口否则当主题切换之后再设置父窗口的时候palette会更改为主题切换前的palette
if (QWidget *w = m_pluginInter->itemPopupApplet(m_itemKey)) {
w->setParent(PopupWindow.data());
w->setVisible(false);
}
m_popupTipsDelayTimer->setInterval(500);
@ -306,6 +307,12 @@ void SystemTrayItem::hidePopup()
m_popupShown = false;
PopupWindow->hide();
DockPopupWindow *popup = PopupWindow.data();
QWidget *content = popup->getContent();
if (content) {
content->setVisible(false);
}
emit PopupWindow->accept();
emit requestWindowAutoHide(true);
}
@ -330,8 +337,10 @@ void SystemTrayItem::popupWindowAccept()
void SystemTrayItem::showPopupApplet(QWidget *const applet)
{
// another model popup window already exists
if (PopupWindow->model())
if (PopupWindow->model()) {
applet->setVisible(false);
return;
}
if (!applet) {
return;