[Interest] Multi-line text in QLabel!

Lata Agrawal lata.agrawal at enrouteinc.com
Sat Mar 31 15:41:56 CEST 2012


I am trying to display multi-line string in QLabel. I read this string from
an XML file which is of the format:

<?xml version="1.0" encoding="UTF-8"?>
      <text>*First Line\nSecond line*</text>

I don't want to use wordwrap because I want to control where to insert line
breaks in the string displayed. In code, I re-formatted the string read
from XML file as string read from XML file is converted from \n to \\n.

    QStringList strList = q.questext.split("\\n");
    QString strText = "";
    foreach (QString str, strList)
        strText = str;
        strText += "\n";
        qDebug("strText is %s@@@@@@\n",qPrintable(strText));

This works fine on Linux_x86 but when I run the same code on Embedded
Linux(MIPS), the string appears in a single line ignoring the line breaks.
Also the qDebug prints the formatted text properly i.e. with line breaks,
on both Linux_x86 and Linux/MIPS.

Can anyone point out whats wrong here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120331/29ab8219/attachment.html>

More information about the Interest mailing list