Replace newlines with HTML line breaks in message dialogs

* Keeps readability of translation strings without losing line breaks due to forced rich text display
This commit is contained in:
Jonathan White 2025-05-18 10:10:57 -04:00
parent f62ea95499
commit e2cf37a91f

View file

@ -91,7 +91,9 @@ MessageBox::Button MessageBox::messageBox(QWidget* parent,
msgBox.setTextFormat(Qt::RichText);
msgBox.setIcon(icon);
msgBox.setWindowTitle(title);
msgBox.setText(text);
// Replace newlines with HTML line breaks
auto fixedText = text;
msgBox.setText(fixedText.replace("\n", "<br>"));
if (m_overrideParent) {
// Force the creation of the QWindow, without this windowHandle() will return nullptr