[Qt-interest] Measuring the display width of text
Nikos Chantziaras
realnc at arcor.de
Sun Feb 28 04:28:40 CET 2010
On 02/27/2010 02:55 AM, william.crocker at analog.com wrote:
>
>>
>> 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.
Thanks. I'm using binary search now to determine the length, but can
you explain a bit more about what you mean with caching?
More information about the Qt-interest-old
mailing list