Fixed closing popup if parent popup was closed

This commit is contained in:
Eism 2022-05-12 16:03:33 +03:00
parent 2b3d4b9b36
commit 95262cc4b2
3 changed files with 8 additions and 2 deletions

View file

@ -157,8 +157,6 @@ ListItemBlank {
menu.model = modelData.subitems
menu.anchorItem = root.menuAnchorItem
menu.setParentWindow(root.parentWindow)
menu.handleMenuItem.connect(function(itemId) {
Qt.callLater(root.handleMenuItem, itemId)
menu.close()

View file

@ -692,6 +692,8 @@ void PopupView::resolveNavigationParentControl()
connect(qmlCtrl, &QObject::destroyed, this, [this]() {
setNavigationParentControl(nullptr);
});
setParentWindow(ctrl->window());
}
}

View file

@ -121,6 +121,12 @@ void PopupWindow_QQuickView::show(QScreen* screen, QPoint position, bool activat
QWindow* parent = m_parentWindow ? m_parentWindow : interactiveProvider()->topWindow();
m_view->setTransientParent(parent);
connect(parent, &QWindow::visibleChanged, this, [this](){
if (!m_view->transientParent() || !m_view->transientParent()->isVisible()) {
close();
}
});
m_view->show();
if (activateFocus) {