Skip to content
Permalink
Browse files

Merge pull request #8280 from CookiePLMonster/alert-msg-box-modality-fix

Make alert messages application modal and not window modal
  • Loading branch information...
stenzek committed Aug 20, 2019
2 parents e71cab0 + 3fe8ef4 commit 6efab4e3c6322839a9156d953b321b5da621de91
@@ -39,7 +39,7 @@ static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no
Common::MsgType style)
{
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.setText(QString::fromUtf8(text));

@@ -6,10 +6,10 @@

#include <QApplication>

ModalMessageBox::ModalMessageBox(QWidget* parent)
ModalMessageBox::ModalMessageBox(QWidget* parent, Qt::WindowModality modality)
: QMessageBox(parent != nullptr ? parent->window() : nullptr)
{
setWindowModality(Qt::WindowModal);
setWindowModality(modality);
setWindowFlags(Qt::Sheet | Qt::WindowTitleHint | Qt::CustomizeWindowHint);

// No parent is still preferable to showing a hidden parent here.
@@ -10,7 +10,7 @@
class ModalMessageBox : public QMessageBox
{
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,
StandardButtons buttons = Ok, StandardButton default_button = NoButton);

0 comments on commit 6efab4e

Please sign in to comment.
You can’t perform that action at this time.