1

I am new to Qt and am slowly finding my way around. My goal is to have a QListView of a QFileSytemModel where the names of the files in the icons wraps, similar to the behavior found on any OS where the text gets split if the name is too long.

From perusing the internet, I believe I need to create a custom class that extends QAbstractItemDelegate to do my special drawing and text wrapping. However, I haven't been able to find the default ItemDelegate that the stock QListView class uses out of the box.

The reason I want the default class is so I can poke around and figure out more about the life-cycle of Qt components while working on my own renderer. I was wondering if anyone knew of where the default renderer for the QListView class could be found?

Daniel Hedberg
  • 5,677
  • 4
  • 36
  • 61
Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
  • 1
    The source code is available, I would recommend you to have a look at it. It's pretty well documented and a gret source of inspiration! – Daniel Hedberg Feb 07 '13 at 03:48
  • @DanielHedberg This wasn't a terribly helpful response. Like I said in my question, I've looked at the source and still can't find where the default QItemDelegate for the QListView is located and its paint routine. – Black Dynamite Feb 07 '13 at 13:58
  • I'm sorry if you didn't find my comment helpful. It wasn't meant to be an answer. See my answer further down. – Daniel Hedberg Feb 07 '13 at 15:48

1 Answers1

1

If you want to show icons with text, QListView has a mode to do that, just set the view mode to QListView::IconMode using QListView::setViewMode(). If you still want to customize display features it is right that you should implement a custom item delegate, preferably subclassing QItemDelegate and overriding paint() with your own implementation.

Daniel Hedberg
  • 5,677
  • 4
  • 36
  • 61