mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
Bring a modal window back to front when opening a dialog
Otherwise it can happen the modal window in background blocks the other UI.
This commit is contained in:
@@ -31,8 +31,10 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CAircraftModelSetValidationDialog::validatedModelSet(const CSimulatorInfo &simulator, const CAircraftModelList &valid, const CAircraftModelList &invalid, bool stopped, const CStatusMessageList &msgs)
|
void CAircraftModelSetValidationDialog::validatedModelSet(const CSimulatorInfo &simulator, const CAircraftModelList &valid, const CAircraftModelList &invalid, bool stopped, const CStatusMessageList &msgs)
|
||||||
{
|
{
|
||||||
|
if (!sGui) { return; }
|
||||||
ui->comp_AircraftModelValidation->validatedModelSet(simulator, valid, invalid, stopped, msgs);
|
ui->comp_AircraftModelValidation->validatedModelSet(simulator, valid, invalid, stopped, msgs);
|
||||||
this->setWindowTitle(QStringLiteral("Model validation for '%1'").arg(simulator.toQString(true)));
|
this->setWindowTitle(QStringLiteral("Model validation for '%1'").arg(simulator.toQString(true)));
|
||||||
|
CGuiApplication::modalWindowToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModelSetValidationDialog::event(QEvent *event)
|
bool CAircraftModelSetValidationDialog::event(QEvent *event)
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "autopublishdialog.h"
|
#include "autopublishdialog.h"
|
||||||
|
#include "blackgui/guiapplication.h"
|
||||||
#include "ui_autopublishdialog.h"
|
#include "ui_autopublishdialog.h"
|
||||||
|
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
@@ -33,8 +35,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
const int r = ui->comp_AutoPublish->readFiles();
|
const int r = ui->comp_AutoPublish->readFiles();
|
||||||
this->show();
|
this->show();
|
||||||
|
CGuiApplication::modalWindowToFront();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace BlackGui
|
|||||||
bool CDbLoadDataDialog::newerOrEmptyEntitiesDetected(CEntityFlags::Entity loadEntities)
|
bool CDbLoadDataDialog::newerOrEmptyEntitiesDetected(CEntityFlags::Entity loadEntities)
|
||||||
{
|
{
|
||||||
this->show();
|
this->show();
|
||||||
|
CGuiApplication::modalWindowToFront();
|
||||||
if (m_consolidating) { return false; }
|
if (m_consolidating) { return false; }
|
||||||
if (m_pendingEntities != CEntityFlags::NoEntity) { return false; } // already loading
|
if (m_pendingEntities != CEntityFlags::NoEntity) { return false; } // already loading
|
||||||
if (loadEntities == CEntityFlags::NoEntity) { return false; }
|
if (loadEntities == CEntityFlags::NoEntity) { return false; }
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QWindow>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QWhatsThis>
|
#include <QWhatsThis>
|
||||||
@@ -357,6 +358,12 @@ namespace BlackGui
|
|||||||
return s->geometry();
|
return s->geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGuiApplication::modalWindowToFront()
|
||||||
|
{
|
||||||
|
if (!QGuiApplication::modalWindow()) { return; }
|
||||||
|
QGuiApplication::modalWindow()->raise();
|
||||||
|
}
|
||||||
|
|
||||||
bool CGuiApplication::saveWindowGeometryAndState(const QMainWindow *window) const
|
bool CGuiApplication::saveWindowGeometryAndState(const QMainWindow *window) const
|
||||||
{
|
{
|
||||||
if (!window) { return false; }
|
if (!window) { return false; }
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
#ifndef BLACKGUI_GUIAPPLICATION_H
|
#ifndef BLACKGUI_GUIAPPLICATION_H
|
||||||
#define BLACKGUI_GUIAPPLICATION_H
|
#define BLACKGUI_GUIAPPLICATION_H
|
||||||
|
|
||||||
#include "blackcore/application.h"
|
|
||||||
#include "blackgui/blackguiexport.h"
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
|
||||||
#include "blackgui/mainwindowaccess.h"
|
|
||||||
#include "blackgui/settings/guisettings.h"
|
#include "blackgui/settings/guisettings.h"
|
||||||
#include "blackgui/settings/updatenotification.h"
|
#include "blackgui/settings/updatenotification.h"
|
||||||
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
|
#include "blackgui/mainwindowaccess.h"
|
||||||
#include "blackgui/stylesheetutility.h"
|
#include "blackgui/stylesheetutility.h"
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
#include "blackmisc/network/networkutils.h"
|
#include "blackmisc/network/networkutils.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
@@ -266,6 +266,9 @@ namespace BlackGui
|
|||||||
//! \remark logical resolution, not physical resolution
|
//! \remark logical resolution, not physical resolution
|
||||||
static QRect currentScreenGeometry();
|
static QRect currentScreenGeometry();
|
||||||
|
|
||||||
|
//! Bring any modal dialog to front
|
||||||
|
static void modalWindowToFront();
|
||||||
|
|
||||||
//! Parse scale factor if any
|
//! Parse scale factor if any
|
||||||
static double parseScaleFactor(int argc, char *argv[]);
|
static double parseScaleFactor(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ namespace BlackSimPlugin
|
|||||||
const QPointer<CSimulatorEmulated> myself(this);
|
const QPointer<CSimulatorEmulated> myself(this);
|
||||||
QTimer::singleShot(1000, this, [ = ]
|
QTimer::singleShot(1000, this, [ = ]
|
||||||
{
|
{
|
||||||
if (myself.isNull()) { return; }
|
if (myself.isNull() || !sGui || sGui->isShuttingDown()) { return; }
|
||||||
this->emitSimulatorCombinedStatus();
|
this->emitSimulatorCombinedStatus();
|
||||||
m_monitorWidget->show();
|
m_monitorWidget->show();
|
||||||
|
CGuiApplication::modalWindowToFront();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO); }
|
if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO); }
|
||||||
|
|||||||
Reference in New Issue
Block a user