Fix QT pWindow::setModal

As in higan, not my code.
This commit is contained in:
Kawa-oneechan 2020-04-07 20:32:45 +02:00
parent 1ebed1701a
commit 882e5d292f
1 changed files with 8 additions and 3 deletions

View File

@ -193,10 +193,11 @@ auto pWindow::setMinimumSize(Size size) -> void {
auto pWindow::setModal(bool modal) -> void {
if(modal) {
//windowModality can only be enabled while window is invisible
setVisible(false);
bool isVisible = qtWindow->isVisible();
if(isVisible) setVisible(false);
qtWindow->setWindowModality(Qt::ApplicationModal);
setVisible(true);
if(isVisible) setVisible(true);
while(!Application::state().quit && state().modal) {
if(Application::state().onMain) {
Application::doMain();
@ -205,7 +206,11 @@ auto pWindow::setModal(bool modal) -> void {
}
Application::processEvents();
}
isVisible = qtWindow->isVisible();
if(isVisible) setVisible(false);
qtWindow->setWindowModality(Qt::NonModal);
if(isVisible) setVisible(true);
}
}