[Qt-interest] Wrapping text in a listviewItem

Andre Somers andre at familiesomers.nl
Tue Mar 2 11:41:37 CET 2010


Nishant Sharma wrote:
> Thanks Alessandro
> But, I am using QT - 3.3.6 and this API does not seem to be present in 
> that release. This was introduced in 4.2
Please be explicit in your query if you use an old version. It is 
reasonable that people expect that you use a recent version, say 4.5 or 
later, if you don't specify otherwise. It is always a good idea to be 
explicit about versions and platforms, but even more so if you are using 
a version this old. Qt 3.3.6 is about 4 years old, i guess. Perhaps 
upgrading to Qt 4.6 would be a good start, if possible?

Sorry, I don't have an answer to your original query. My Qt 3.x is too 
rusty, and the docs don't give an immediate, obvious way to do it. It 
could be that you may need to subclass QListViewItem and do the painting 
yourself using QPainter::drawText and QFontMetrics to find out about the 
spacing and dimensions of your text. Not a very attractive solution...

André






More information about the Qt-interest-old mailing list