fix: popupwindow need click destkop twice to hide

Log: only not hide it when focus widget is QLineEdit
This commit is contained in:
chenhongtao 2023-05-05 13:39:44 +08:00 committed by Access
parent 69cec726c3
commit 24ff57eb70

View File

@ -213,11 +213,6 @@ 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();
@ -233,6 +228,16 @@ void DockPopupWindow::onButtonPress(int type, int x, int y, const QString &key)
return;
}
// if there is something focus on widget, return
if (auto focus = qApp->focusWidget()) {
auto className = QString(focus->metaObject()->className());
qDebug() << "Find focused widget, focus className is" << className;
if (className == "QLineEdit") {
qDebug() << "PopupWindow window will not be hidden";
return;
}
}
emit accept();
hide();
}