ModalMessageBox: Remove superfluous buttons and ensure correct parent

This commit is contained in:
spycrab 2019-03-11 18:20:13 +01:00
parent 8293724f4e
commit 63fd931245
1 changed files with 4 additions and 3 deletions

View File

@ -6,13 +6,14 @@
#include <QApplication>
ModalMessageBox::ModalMessageBox(QWidget* parent) : QMessageBox(parent)
ModalMessageBox::ModalMessageBox(QWidget* parent)
: QMessageBox(parent != nullptr ? parent->window() : nullptr)
{
setWindowModality(Qt::WindowModal);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowFlags(Qt::Sheet | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
// No parent is still preferable to showing a hidden parent here.
if (parent != nullptr && !parent->isVisible())
if (parent != nullptr && !parent->window()->isVisible())
setParent(nullptr);
}