mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Make alert messages application modal and not window modal,
so assertions cannot be interrupted by terminating the application
This commit is contained in:
@ -39,7 +39,7 @@ static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no
|
|||||||
Common::MsgType style)
|
Common::MsgType style)
|
||||||
{
|
{
|
||||||
std::optional<bool> r = RunOnObject(QApplication::instance(), [&] {
|
std::optional<bool> r = RunOnObject(QApplication::instance(), [&] {
|
||||||
ModalMessageBox message_box(QApplication::activeWindow());
|
ModalMessageBox message_box(QApplication::activeWindow(), Qt::ApplicationModal);
|
||||||
message_box.setWindowTitle(QString::fromUtf8(caption));
|
message_box.setWindowTitle(QString::fromUtf8(caption));
|
||||||
message_box.setText(QString::fromUtf8(text));
|
message_box.setText(QString::fromUtf8(text));
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
ModalMessageBox::ModalMessageBox(QWidget* parent)
|
ModalMessageBox::ModalMessageBox(QWidget* parent, Qt::WindowModality modality)
|
||||||
: QMessageBox(parent != nullptr ? parent->window() : nullptr)
|
: QMessageBox(parent != nullptr ? parent->window() : nullptr)
|
||||||
{
|
{
|
||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(modality);
|
||||||
setWindowFlags(Qt::Sheet | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
|
setWindowFlags(Qt::Sheet | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
|
||||||
|
|
||||||
// No parent is still preferable to showing a hidden parent here.
|
// No parent is still preferable to showing a hidden parent here.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
class ModalMessageBox : public QMessageBox
|
class ModalMessageBox : public QMessageBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ModalMessageBox(QWidget* parent);
|
explicit ModalMessageBox(QWidget* parent, Qt::WindowModality modality = Qt::WindowModal);
|
||||||
|
|
||||||
static int critical(QWidget* parent, const QString& title, const QString& text,
|
static int critical(QWidget* parent, const QString& title, const QString& text,
|
||||||
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
|
StandardButtons buttons = Ok, StandardButton default_button = NoButton);
|
||||||
|
Reference in New Issue
Block a user