From 882e5d292f2d5c4eb282f5ea7cfb2122cfc9c395 Mon Sep 17 00:00:00 2001 From: Kawa-oneechan Date: Tue, 7 Apr 2020 20:32:45 +0200 Subject: [PATCH] Fix QT pWindow::setModal As in higan, not my code. --- hiro/qt/window.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hiro/qt/window.cpp b/hiro/qt/window.cpp index 3ef5504c..0349a231 100755 --- a/hiro/qt/window.cpp +++ b/hiro/qt/window.cpp @@ -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); } }