Unsolved How to add newline to a QString? - repost
-
Re: How to add newline to a QString?
The attached C code FAILS to insert "\n" or "\t" when the main variable is QString. ( string concatenation)
QString text = "VERIFY SUCCESS OK allocated extended server socket "; text += "\n"; text += QString::number(server_socket); text += "\n"; text += Q_FUNC_INFO; text += " @ line "; text += QString::number(__LINE__); qDebug() << text;
Here is the actual code output
"int MainWindow_C_CODE_FORM::C_CODE_Scanner() @ line 211" "VERIFY SUCCESS OK allocated extended server socket \n26\nint MainWindow_C_CODE_FORM::C_CODE_Scanner() @ line 238"
I am looking for explanation / solution - preferably using QString
-
@AnneRanch use
qDebug().noquote() << text;
-
Already answered three days ago here: https://forum.qt.io/topic/144069/
And again: You must not use qDebug() for formatted output to the console as it is for debugging purposes. Closing this thread.
-