From bbc3c6bc620543c19c4f308245c258e689126453 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 18 Apr 2019 16:15:41 +0200 Subject: [PATCH] more checks for QskDialogSubWindow::exec --- src/dialogs/QskDialogSubWindow.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/dialogs/QskDialogSubWindow.cpp b/src/dialogs/QskDialogSubWindow.cpp index 0a231924..56815948 100644 --- a/src/dialogs/QskDialogSubWindow.cpp +++ b/src/dialogs/QskDialogSubWindow.cpp @@ -237,9 +237,18 @@ QskDialog::DialogCode QskDialogSubWindow::result() const QskDialog::DialogCode QskDialogSubWindow::exec() { + if ( priority() > 0 ) + { + qWarning( "illegal call of QskDialogSubWindow::exec " + "for a subwindow with non default priority." ); + } + + open(); + + //check for window after call to open(), because maybe a popupmanager assigns a window on open. if ( window() == nullptr ) { - qWarning( "trying to exec a subwindow without window. " ); + qWarning( "trying to exec a subwindow without window." ); return QskDialog::Rejected; } @@ -247,12 +256,11 @@ QskDialog::DialogCode QskDialogSubWindow::exec() { // when being called from QQuickWindow::mouseReleaseEvent // the mouse grabber has not yet been released. - - mouseGrabber->ungrabMouse(); + + if( !qskIsAncestorOf( this, mouseGrabber ) ) + mouseGrabber->ungrabMouse(); } - open(); - QEventLoop eventLoop; connect( this, &QskDialogSubWindow::finished, &eventLoop, &QEventLoop::quit );