@@ -333,21 +333,21 @@ void QgsProcessingAlgorithmDialogBase::pushInfo( const QString &info )
333
333
334
334
void QgsProcessingAlgorithmDialogBase::pushCommandInfo ( const QString &command )
335
335
{
336
- txtLog->append ( QStringLiteral ( " <code>%1<code>" ).arg ( command.toHtmlEscaped () ) );
336
+ txtLog->append ( QStringLiteral ( " <code>%1<code>" ).arg ( formatStringForLog ( command.toHtmlEscaped () ) ) );
337
337
scrollToBottomOfLog ();
338
338
processEvents ();
339
339
}
340
340
341
341
void QgsProcessingAlgorithmDialogBase::pushDebugInfo ( const QString &message )
342
342
{
343
- txtLog->append ( QStringLiteral ( " <span style=\" color:blue\" >%1</span>" ).arg ( message.toHtmlEscaped () ) );
343
+ txtLog->append ( QStringLiteral ( " <span style=\" color:blue\" >%1</span>" ).arg ( formatStringForLog ( message.toHtmlEscaped () ) ) );
344
344
scrollToBottomOfLog ();
345
345
processEvents ();
346
346
}
347
347
348
348
void QgsProcessingAlgorithmDialogBase::pushConsoleInfo ( const QString &info )
349
349
{
350
- txtLog->append ( QStringLiteral ( " <code><span style=\" color:blue\" >%1</darkgray></code>" ).arg ( info.toHtmlEscaped () ) );
350
+ txtLog->append ( QStringLiteral ( " <code><span style=\" color:blue\" >%1</darkgray></code>" ).arg ( formatStringForLog ( info.toHtmlEscaped () ) ) );
351
351
scrollToBottomOfLog ();
352
352
processEvents ();
353
353
}
@@ -474,14 +474,21 @@ void QgsProcessingAlgorithmDialogBase::setCurrentTask( QgsProcessingAlgRunnerTas
474
474
QgsApplication::taskManager ()->addTask ( mAlgorithmTask );
475
475
}
476
476
477
+ QString QgsProcessingAlgorithmDialogBase::formatStringForLog ( const QString &string )
478
+ {
479
+ QString s = string;
480
+ s.replace ( ' \n ' , QStringLiteral ( " <br>" ) );
481
+ return s;
482
+ }
483
+
477
484
void QgsProcessingAlgorithmDialogBase::setInfo ( const QString &message, bool isError, bool escapeHtml )
478
485
{
479
486
if ( isError )
480
- txtLog->append ( QStringLiteral ( " <span style=\" color:red\" >%1</span>" ).arg ( message ) );
487
+ txtLog->append ( QStringLiteral ( " <span style=\" color:red\" >%1</span>" ).arg ( formatStringForLog ( message ) ) );
481
488
else if ( escapeHtml )
482
- txtLog->append ( message.toHtmlEscaped () );
489
+ txtLog->append ( formatStringForLog ( message.toHtmlEscaped () ) );
483
490
else
484
- txtLog->append ( message );
491
+ txtLog->append ( formatStringForLog ( message ) );
485
492
scrollToBottomOfLog ();
486
493
processEvents ();
487
494
}
0 commit comments