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