From c2ba4e4971f3abccb746e6a6ce6fdf9ff548ccc5 Mon Sep 17 00:00:00 2001 From: chenhongtao Date: Wed, 12 Apr 2023 13:41:52 +0800 Subject: [PATCH] fix: when there is focus on dockpopupwindow, it hide Log: fix when there is focus and dockpopupwindow hide --- frame/util/dockpopupwindow.cpp | 5 +++++ frame/util/dockpopupwindow.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frame/util/dockpopupwindow.cpp b/frame/util/dockpopupwindow.cpp index 8f7fd14f8..b2b970268 100644 --- a/frame/util/dockpopupwindow.cpp +++ b/frame/util/dockpopupwindow.cpp @@ -213,6 +213,11 @@ void DockPopupWindow::ensureRaised() void DockPopupWindow::onButtonPress(int type, int x, int y, const QString &key) { + // if there is something focus on widget, return + if (auto focus = qApp->focusWidget()) { + qDebug() << "PopupWindow not hide, focus className is" << focus->metaObject()->className(); + return; + } if (!m_enableMouseRelease) return; QRect screenRect = this->screen()->geometry(); diff --git a/frame/util/dockpopupwindow.h b/frame/util/dockpopupwindow.h index b946eefeb..72060cf14 100644 --- a/frame/util/dockpopupwindow.h +++ b/frame/util/dockpopupwindow.h @@ -52,10 +52,10 @@ signals: void unusedSignal(); protected: - void showEvent(QShowEvent *e); - void hideEvent(QHideEvent *event); - void enterEvent(QEvent *e); - bool eventFilter(QObject *o, QEvent *e); + void showEvent(QShowEvent *e) override; + void hideEvent(QHideEvent *event) override; + void enterEvent(QEvent *e) override; + bool eventFilter(QObject *o, QEvent *e) override; void blockButtonRelease(); private slots: