Another fix for "dialog closing closes swift",

see https://discordapp.com/channels/539048679160676382/567139633964646411/620776182027386880

The signal for the navigator dialog closed
is not send or received in some cases, not clear why.

Using a reference directly to the main window as workaround.
This commit is contained in:
Klaus Basan
2019-09-12 11:22:26 +02:00
committed by Mat Sutcliffe
parent af1b933e5c
commit 4fc151f4cb
3 changed files with 24 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
#include <QAction>
#include <QEvent>
#include <QFrame>
#include <QMainWindow>
#include <QGridLayout>
#include <QIcon>
#include <QList>
@@ -30,6 +31,7 @@
#include <QVariant>
#include <Qt>
#include <QStringBuilder>
#include <QGuiApplication>
#include <QtGlobal>
using namespace BlackGui;
@@ -57,6 +59,9 @@ namespace BlackGui
m_marginMenuAction = new QWidgetAction(this);
m_marginMenuAction->setDefaultWidget(m_input);
// Quit on window hack
m_originalQuitOnLastWindow = QGuiApplication::quitOnLastWindowClosed();
// timer
m_watchdog.setObjectName(this->objectName() + ":m_timer");
connect(&m_watchdog, &QTimer::timeout, this, &CNavigatorDialog::onWatchdog);
@@ -118,6 +123,14 @@ namespace BlackGui
void CNavigatorDialog::reject()
{
// workaround to avoid "closing issue with navigator",
// https://discordapp.com/channels/539048679160676382/567139633964646411/620776182027386880
if (m_mainWindow)
{
QGuiApplication::setQuitOnLastWindowClosed(m_originalQuitOnLastWindow);
m_mainWindow->show();
}
this->hide();
m_watchdog.stop();
emit this->navigatorClosed();
@@ -133,6 +146,7 @@ namespace BlackGui
this->setVisible(visible);
CGuiUtility::stayOnTop(visible, this);
this->show();
QGuiApplication::setQuitOnLastWindowClosed(visible ? false : m_originalQuitOnLastWindow); // avoid issues with a dialog closing everything
if (visible)
{