[Qt-interest] QLabel wrap anywhere

Jordan Upham jupham at zipitwireless.com
Wed Aug 18 17:16:43 CEST 2010


Andre,

Using QLabel::setWordWrap() will only wrap on whitespace but I need the text
to wrap when it reaches a certain width regardless if there is a whitespace
or not.

Thanks,
Jordan Upham

On Wed, Aug 18, 2010 at 11:13 AM, Andre Haupt <andre at bitwigglers.org> wrote:

> On Wed, Aug 18, 2010 at 10:52:33AM -0400, Jordan Upham wrote:
> > Hi,
> >
> > I'm looking for a way to wrap a QLabel anywhere and not just on line
> breaks.
> >  I know this is possible with QTextEdits and I have thought about just
> using
> > those instead of QLabels where I need this behavior but I am running on a
> > mobile device and I am worried about performance of this.  Is there a way
> to
> > figure out how much text of a given string will fit in a given width?
>  I'm
> > thinking it is probably possible with QFontMetrics but I'm not sure.
> >
>
> QLabel::setWordWrap() comes to mind. Is this what you are looking for?
>
> regards,
>
> Andre
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100818/bce431a5/attachment.html 


More information about the Qt-interest-old mailing list