Concatenating QString "\n" missess " new line
Moved
Unsolved
General and Desktop
-
Here is my code :
#ifdef C_CODE_TRACE text = " \n"; text += "SUCCESS dev_id = hci_get_route "; text += QString::number(QET.elapsed()); text += " mS"; ui->textEdit->append(text); text += Q_FUNC_INFO; text += " @ line "; text += QString::number(__LINE__); text += "\t\n VERIFY dev_id = hci_get_route "; text += QString::number( dev_id ); text += "\n"; qDebug() << text; #endif ```Here is my debug output : " /n \nSUCCESS dev_id = hci_get_route 0 mSint MainWindow_C_CODE_FORM::C_CODE_Scanner() @ line 289\t\n VERIFY dev_id = hci_get_route 0\n" What am I doing wrong since I do not get "new line \n " or "tab \t" as expected? text is defined as QString text;
-
Christian Ehrlicher Lifetime Qt Championreplied to Anonymous_Banned275 on last edited by Christian Ehrlicher
@AnneRanch said in Concatenating QString "\n" missess " new line:
What am I doing wrong since I do not get "new line \n " or "tab \t" as expected?
But your debug output shows the newline and tab exactly as you added them before.
e.g. '289\t\n VERIFY' - a tab and a newline as debug output.
-
-
@AnneRanch said in Concatenating QString "\n" missess " new line:
qDebug() << qPrintable(text); -
@mpergand Sorry, not a full solution .
" \nSUCCESS dev_id = hci_get_route \n0\n mS \nint MainWindow_C_CODE_FORM::C_CODE_Scanner() @ line 289\t\n VERIFY dev_id = hci_get_route 0\n" SUCCESS dev_id = hci_get_route 0 mS int MainWindow_C_CODE_FORM::C_CODE_Scanner() @ line 289 VERIFY dev_id = hci_get_route 0 NO TAB HERE
It only works when "new line" IS the only code in " text += "....
#ifdef C_CODE_TRACE text = " \n"; text += "SUCCESS dev_id = hci_get_route \n"; text += QString::number(QET.elapsed()); text += "\n mS \n"; //text += &(ii+i)->bdaddr.toString(); //text += name; // ui->textEdit->append(text); text += Q_FUNC_INFO; text += " @ line "; text += QString::number(__LINE__); text += "\t\n VERIFY dev_id = hci_get_route "; text += QString::number( dev_id ); text += "\n"; qDebug() << text; qDebug() << qPrintable(text); #endif
'
-
Christian Ehrlicher Lifetime Qt Championreplied to Anonymous_Banned275 on last edited by Christian Ehrlicher
You must not use qDebug() when you want to output something to the console not indented for debug output...
-