   [Qt] Creating a custom tree/list widget
  I want to create a custom widget to display a list of items which can be expanded like a tree item. Similar to the message list in Winspector (see screenshot below).There are a few things that it needs to do.Firstly, it should get the data from a list of objects stored elsewhere (in my MessageHandler class). So the data is stored in a model as well as in the view as item objects. For efficiency, i do not want to completely recreate the list every time an object is added.Secondly, it needs to handle adding/removing/filtering items. It will only store a maximum number and then start to remove the oldest ones when new ones are added. But it also needs to filter items so that only certain ones are shown. In this case, the actual list (in MessageHandler) will still contain the full number but the widget will show only some. This is tricky because i also need to keep removing from original list if it's getting too big, but the filtered list may not yet be too big.But i am not sure how to do that.Should i subclass QTreeWidget and add QTreeWidgetItems whenever a message is added to the list. If that is the case then it will be hard to do the filtering and trimming to a max size for the reasons i mentioned above.Should i subclass QTreeView and use some sort of model/view? If so i don't know how i would do this.Note: This isn't really a game related question, but it is alternative library related. I asked at the Qt forums too, but it doesn't hurt to ask here as well, just in case someone here is an Qt expert or just knows a lot about model/view programming.Screenshot of Winspector's message list   