From a406ebb68a0056929822eaeb6a2bd66da58bf896 Mon Sep 17 00:00:00 2001 From: donghualin Date: Wed, 16 Nov 2022 12:10:29 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dwayland=E4=B8=8B?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=BF=AB=E6=8D=B7=E9=9D=A2=E6=9D=BFtooltip?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=9A=90=E8=97=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在打开快捷面板的时候,依次调用任务栏的插件图标的隐藏toolTip的功能将其隐藏 Log: Influence: 进入wayland,鼠标放在任务栏的插件上,点击应用弹出快捷面板,观察toolTip是否消失 Bug: https://pms.uniontech.com/bug-view-171551.html Change-Id: Iac6a7c1d55787a73d0f91952c7ca0585f41fd23a --- frame/window/quickpluginwindow.cpp | 19 +++++++++++++++++++ frame/window/quickpluginwindow.h | 1 + 2 files changed, 20 insertions(+) diff --git a/frame/window/quickpluginwindow.cpp b/frame/window/quickpluginwindow.cpp index 812e0cf13..16e85f5b9 100644 --- a/frame/window/quickpluginwindow.cpp +++ b/frame/window/quickpluginwindow.cpp @@ -202,6 +202,20 @@ bool QuickPluginWindow::eventFilter(QObject *watched, QEvent *event) if (!m_dragInfo->canDrag(mouseEvent->pos())) { // 弹出快捷设置面板 DockPopupWindow *popWindow = QuickSettingContainer::popWindow(); + if (Utils::IS_WAYLAND_DISPLAY) { + // TODO: 临时解决方案,如果是wayland环境,toolTip没有消失,因此,此处直接调用接口来隐藏 + for (int i = m_mainLayout->count() - 1; i >= 0; i--) { + QLayoutItem *layoutItem = m_mainLayout->itemAt(i); + if (!layoutItem) + continue; + + QuickDockItem *dockItem = qobject_cast(layoutItem->widget()); + if (!dockItem) + continue; + + dockItem->hideToolTip(); + } + } popWindow->show(popupPoint()); } m_dragInfo->reset(); @@ -533,6 +547,11 @@ bool QuickDockItem::isPrimary() const return false; } +void QuickDockItem::hideToolTip() +{ + m_popupWindow->hide(); +} + void QuickDockItem::paintEvent(QPaintEvent *event) { if (!m_pluginItem) diff --git a/frame/window/quickpluginwindow.h b/frame/window/quickpluginwindow.h index 9d07fac8b..b36eb08a8 100644 --- a/frame/window/quickpluginwindow.h +++ b/frame/window/quickpluginwindow.h @@ -98,6 +98,7 @@ public: void setPositon(Dock::Position position); PluginsItemInterface *pluginItem(); bool isPrimary() const; + void hideToolTip(); protected: void paintEvent(QPaintEvent *event) override;