[Qt-interest] Measuring the display width of text
william.crocker at analog.com
william.crocker at analog.com
Sat Feb 27 01:55:41 CET 2010
>
> Instead, it seems I am forced to call QFontMetrics::size() repeatedly
> while removing trailing characters from the string until enough
> characters have been remove for the string to fit a given width. As you
> can imagine, performance suffers.
>
Binary search for the width and
cache what you learn.
> Is there no better way? QFontMetrics::elidedText() comes close to be
> useful for this, but not quite.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list