PDA

View Full Version : How to make QListview and QFilesystemModel item with multiple line text?



kennylemon
4th August 2011, 11:11
Hi guys:

I want to use a QListView and a QFilesystemModel to customize an icon viewer like the original one in Mac!!!

The original Mac icon viewer:
http://dl.dropbox.com/u/24137109/icon%20text1.png

And the custom icon viewer:
http://dl.dropbox.com/u/24137109/icon%20text2.png

The problem is that the file name in the custom icon viewer can only display single line, however, the original Mac icon viewer can display file name in two lines.

What I should do to make the custom icon viewer displays the file name in two lines.
If two line can not contain all the file name, show ellipsis at the right side of the second line.

Should I subclass QStyledItemDelegate and override paint() function or something else?!?!

Could anyone give me a hint!!

Thanks in advance!!

Kenny