# HG changeset patch # User sheepluva # Date 1402783160 -7200 # Node ID 17f3ca06e39af3481107cf890217270e0b362002 # Parent 7e40820b7ed695f8e262de2d342a7b5b59e4f444 enforce style on message boxes some more diff -r 7e40820b7ed6 -r 17f3ca06e39a QTfrontend/HWApplication.cpp --- a/QTfrontend/HWApplication.cpp Sat Jun 14 15:49:44 2014 +0200 +++ b/QTfrontend/HWApplication.cpp Sat Jun 14 23:59:20 2014 +0200 @@ -20,7 +20,6 @@ #include #include -#include "hwform.h" #include "MessageDialog.h" #if !defined(Q_OS_WIN) diff -r 7e40820b7ed6 -r 17f3ca06e39a QTfrontend/HWApplication.h --- a/QTfrontend/HWApplication.h Sat Jun 14 15:49:44 2014 +0200 +++ b/QTfrontend/HWApplication.h Sat Jun 14 23:59:20 2014 +0200 @@ -20,6 +20,7 @@ #define HWAPP_H #include +#include "hwform.h" class HWForm; class QEvent; diff -r 7e40820b7ed6 -r 17f3ca06e39a QTfrontend/util/MessageDialog.cpp --- a/QTfrontend/util/MessageDialog.cpp Sat Jun 14 15:49:44 2014 +0200 +++ b/QTfrontend/util/MessageDialog.cpp Sat Jun 14 23:59:20 2014 +0200 @@ -19,6 +19,8 @@ #include "MessageDialog.h" #include "HWApplication.h" + + int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent) { return ShowMessage(QMessageBox::tr("Hedgewars - Error"), @@ -51,5 +53,20 @@ msgMsg.setIcon(icon); msgMsg.setWindowModality(Qt::WindowModal); + if (!parent) + { + try + { + /* workaround to make sure style is correct + * I'd rather assign the stylesheet to qApp directly (in main.cpp), + * but the current Stylesheet will ruin the look (e.g. map selection) :( + */ + HWApplication * app = dynamic_cast(HWApplication::instance()); + if (app->form) + msgMsg.setStyleSheet(app->form->styleSheet()); + } + catch (...) { /* nothing */ } + } + return msgMsg.exec(); }