Post navigation

QTreeView / QModel Example (PyQT)

Quick tutorial on how to populate a QTreeView with a QModel. This example was build using PyQT4 and has been tested with the default 2.6.4 python distribution. The package contains a PyDev project and all the necessary modules. Simply run the main.py file to show the dialog together with the QTreeView

The model is constructed with a set of viewable items, derived from a set of base components. This divide might not be necessary but I prefer a strict division between items that can be viewed and the data that is made visible.

This is a typical example of show (better yet, try) don’t tell. So go ahead and download the package. As always, feel free to ask questions!