Qt: Use window modality for message boxes

Stops them opening in the middle of the screen on MacOS.
This commit is contained in:
Stenzek 2024-03-31 23:20:59 +10:00
parent f0f1473b6e
commit 86927ea3eb
No known key found for this signature in database
3 changed files with 5 additions and 0 deletions

View File

@ -141,6 +141,7 @@ void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state)
"have confirmed the bug also occurs with overclocking disabled.\n\nThis warning will only be shown once.");
QMessageBox mb(QMessageBox::Warning, tr("CPU Overclocking Warning"), message, QMessageBox::NoButton, this);
mb.setWindowModality(Qt::WindowModal);
const QAbstractButton* const yes_button =
mb.addButton(tr("Yes, I will confirm bugs without overclocking before reporting."), QMessageBox::YesRole);
mb.addButton(tr("No, take me back to safety."), QMessageBox::NoRole);

View File

@ -1154,6 +1154,7 @@ std::optional<bool> MainWindow::promptForResumeState(const std::string& save_sta
QMessageBox msgbox(this);
msgbox.setIcon(QMessageBox::Question);
msgbox.setWindowTitle(tr("Load Resume State"));
msgbox.setWindowModality(Qt::WindowModal);
msgbox.setText(tr("A resume save state was found for this game, saved at:\n\n%1.\n\nDo you want to load this state, "
"or start from a fresh boot?")
.arg(QDateTime::fromSecsSinceEpoch(sd.ModificationTime, Qt::UTC).toLocalTime().toString()));
@ -2749,6 +2750,7 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav
QMessageBox msgbox(lock.getDialogParent());
msgbox.setIcon(QMessageBox::Question);
msgbox.setWindowTitle(tr("Confirm Shutdown"));
msgbox.setWindowModality(Qt::WindowModal);
msgbox.setText(tr("Are you sure you want to shut down the virtual machine?"));
QCheckBox* save_cb = new QCheckBox(tr("Save State For Resume"), &msgbox);
@ -2992,6 +2994,7 @@ void MainWindow::checkForUpdates(bool display_message)
{
QMessageBox mbox(this);
mbox.setWindowTitle(tr("Updater Error"));
mbox.setWindowModality(Qt::WindowModal);
mbox.setTextFormat(Qt::RichText);
QString message;

View File

@ -304,6 +304,7 @@ bool QtHost::DownloadMissingFont(QWidget* dialog_parent, const char* font_name,
{
QMessageBox msgbox(dialog_parent);
msgbox.setWindowTitle(qApp->translate("QtHost", "Missing Font File"));
msgbox.setWindowModality(Qt::WindowModal);
msgbox.setWindowIcon(QtHost::GetAppIcon());
msgbox.setIcon(QMessageBox::Critical);
msgbox.setTextFormat(Qt::RichText);