diff --git a/src/controllers/controllerengine.cpp b/src/controllers/controllerengine.cpp index a1269291cbc..1ebe3a0fc73 100644 --- a/src/controllers/controllerengine.cpp +++ b/src/controllers/controllerengine.cpp @@ -553,7 +553,9 @@ void ControllerEngine::scriptErrorDialog( tr("The script code needs to be fixed.") + QStringLiteral("

") + additionalErrorText + QStringLiteral("

")); - props->setDetails(detailedError); + // Add "Details" text and set monospace font since they may contain + // backtraces and code. + props->setDetails(detailedError, true); props->setKey(detailedError); // To prevent multiple windows for the same error // Allow user to suppress further notifications about this particular error diff --git a/src/errordialoghandler.cpp b/src/errordialoghandler.cpp index baf008d2406..eb7fd5193b7 100644 --- a/src/errordialoghandler.cpp +++ b/src/errordialoghandler.cpp @@ -27,6 +27,7 @@ ErrorDialogProperties::ErrorDialogProperties() : m_title(Version::applicationName()), + m_detailsUseMonospaceFont(false), m_modal(true), m_shouldQuit(false), m_type(DLG_NONE), @@ -161,6 +162,9 @@ void ErrorDialogHandler::errorDialog(ErrorDialogProperties* pProps) { } if (!props->m_details.isEmpty()) { pMsgBox->setDetailedText(props->m_details); + if (props->m_detailsUseMonospaceFont) { + pMsgBox->setStyleSheet("QTextEdit { font-family: monospace; }"); + } } while (!props->m_buttons.isEmpty()) { diff --git a/src/errordialoghandler.h b/src/errordialoghandler.h index 3a1f028b6ad..eb146ae2ffd 100644 --- a/src/errordialoghandler.h +++ b/src/errordialoghandler.h @@ -68,8 +68,9 @@ class ErrorDialogProperties { } /** Set detailed text (causes "Show Details" button to appear.) */ - inline void setDetails(const QString& text) { + inline void setDetails(const QString& text, bool bUseMonospaceFont = false) { m_details = text; + m_detailsUseMonospaceFont = bUseMonospaceFont; } /** Set whether the box is modal (blocks the GUI) or not */ @@ -112,6 +113,7 @@ class ErrorDialogProperties { QString m_text; QString m_infoText; QString m_details; + bool m_detailsUseMonospaceFont; bool m_modal; bool m_shouldQuit; DialogType m_type;