Hi All,
my first on this forum is regarding QListView.
I have strings of arbitrary length in my model and I want them to wrap in a QListView when the length of the string is longer than the width of the QListView.
QListView::setWordWrap(true) method does not seem to do anything at all.
I created a custom QItemDelegate and reimplemented sizeHint(). I had to make QListView a parent of QItemDelegate, so I can get a width of the QListView.
It did help though. When I drag a border of QListView and make the width smaller, the height of the item increases, based on sizeHint() and the string automatically wraps to the next line. Now when I drag a border of QListView to the other side and increase the width, the strings unwrap, but the height of the item stay the same, leaving empty space. The height of the item area only grows, but never gets smaller despite of the returning value of sizeHint().
Is the any way to fix this behaviour?
serega.
Bookmarks