[Qt-interest] \n problem...
amulya rattan
talk2amulya at gmail.com
Wed Feb 10 16:49:20 CET 2010
Hi there,
This is probably a fantastically dumb question, but kindly bear with me.
Scenario:
I have to show certain error messages, read from a file, line by line. Each
error message contains "\n" in it when its too big. Note that each line in
the file is just one error string. For example, lets assume file has just
one line
do\nyou\nreally\ncare\nabout\nthe\nmorgans
Now the problem is, when i read this error message into a QString and then
do a label->setText(justReadQString). This sets the label's text without
taking care of \n. It shows the \n instead of putting further text into a
new line.
Although if i have a QString with takes its value from a const char*(QString
data = "do\nyou\nreally\ncare\nabout\nthe\nmorgans";) ..and then use this
QString as label's text, it works fine and it always did...
I guessed i'd just have to convert the QString i got from file into a const
char* and all would be well. But to no avail...
Question:
WHY is this happening??
Probably after hearing the answer, i'd feel like hiding under my bed for a
few days..but please, let me have it..thanks a heap!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100210/92d2baf4/attachment.html
More information about the Qt-interest-old
mailing list