more checks for QskDialogSubWindow::exec

This commit is contained in:
Uwe Rathmann 2019-04-18 16:15:41 +02:00
parent 05d9b98dd7
commit bbc3c6bc62

View File

@ -237,9 +237,18 @@ QskDialog::DialogCode QskDialogSubWindow::result() const
QskDialog::DialogCode QskDialogSubWindow::exec() 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 ) if ( window() == nullptr )
{ {
qWarning( "trying to exec a subwindow without window. " ); qWarning( "trying to exec a subwindow without window." );
return QskDialog::Rejected; return QskDialog::Rejected;
} }
@ -247,12 +256,11 @@ QskDialog::DialogCode QskDialogSubWindow::exec()
{ {
// when being called from QQuickWindow::mouseReleaseEvent // when being called from QQuickWindow::mouseReleaseEvent
// the mouse grabber has not yet been released. // the mouse grabber has not yet been released.
mouseGrabber->ungrabMouse(); if( !qskIsAncestorOf( this, mouseGrabber ) )
mouseGrabber->ungrabMouse();
} }
open();
QEventLoop eventLoop; QEventLoop eventLoop;
connect( this, &QskDialogSubWindow::finished, &eventLoop, &QEventLoop::quit ); connect( this, &QskDialogSubWindow::finished, &eventLoop, &QEventLoop::quit );