[Qt-interest] Prevent word-wrap between text and image in QLabel

Jason H scorp1us at yahoo.com
Fri Nov 20 19:54:14 CET 2009


 Have you tried the html entity   ?




________________________________
From: Jugdish <jugdizh at gmail.com>
To: qt-interest at trolltech.com
Sent: Fri, November 20, 2009 12:57:29 PM
Subject: [Qt-interest] Prevent word-wrap between text and image in QLabel

Is there an easy way to prevent an image and its neighboring text from breaking on lines in a QLabel that has wordWrap enabled?

For example, consider this label:

QLabel *label = new QLabel(this);
label->setWordWrap(true);
label->setText("<img src=\":/icon.png\">item1, <img src=\":/icon.png\">item2, <img src=\"icon.png\">item3");

I would like the lines to wrap only where there is a space in the text and not in between an item and its icon. I have tried various HTML things like using <nobr></nobr> tags, or <span style='white-space:pre'></span> but this has no effect. Any ideas?

Thanks



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091120/940619e1/attachment.html 


More information about the Qt-interest-old mailing list