diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtInstance.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index f2f8caa6b86a..6b3bd0cc301a 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -792,7 +792,21 @@ weld::MessageDialog* QtInstance::CreateMessageDialog(weld::Widget* pParent, } else { - QMessageBox* pMessageBox = new QMessageBox(); + QWidget* pQtParent = nullptr; + if (pParent) + { + if (QtInstanceWidget* pQtInstanceWidget = dynamic_cast<QtInstanceWidget*>(pParent)) + { + pQtParent = pQtInstanceWidget->getQWidget(); + } + else + { + // the parent is not welded/not a native Qt widget; fall back to currently active window + pQtParent = QApplication::activeWindow(); + } + } + + QMessageBox* pMessageBox = new QMessageBox(pQtParent); pMessageBox->setText(toQString(rPrimaryMessage)); pMessageBox->setIcon(vclMessageTypeToQtIcon(eMessageType)); pMessageBox->setWindowTitle(vclMessageTypeToQtTitle(eMessageType)); |