Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

QTextEdit and CR

$
0
0
I’m having trouble filling a QTextEdit object with a series of numbers, each one of which is to appear on a separate line. For example, QString blah; for (int i = 1; i < 100; i++)   {      blah += QString::number(i);      blah += tr("\n");   }   qDebug() << blah;   testWidget = new QTextEdit(blah); The call to qDebug() prints just what you would expect: the numbers from 1 to 99, each on a different line. But the QTextEdit object displays the numbers on one long line. If it matters, I’m on Windows. The QTextEdit object is display with everything at the default settings. I tried various combinations of using (or not) tr() in the hope that it might perform some magic, and I tried “\n”, “\n\r”, “\r\n” and (just for kicks) “\r”. They all do the same thing: the CR and/or LF becomes a space. This seems like the sort of thing that must have been discussed umpteen times, but I haven’t found anything helpful.

Viewing all articles
Browse latest Browse all 13965

Trending Articles