I think
that I shall never see
|
|
A poem lovely as a
tree.
-Joyce Kilmer
|
I've written an annotated companion to the simpletreemodel example that comes with PySide/PyQt. The code builds and displays a
hierarchically organized data structure (i.e., a tree) using a model subclassed
from QAbstractItemModel.
I spread it out over multiple posts (see Table of Contents below). When finished, I'll put the entire series of posts into a single PDF and put a link to it in this post.
In Part I we will briefly
review the model/view framework, focusing on details relevant for implementing our
example. In sections II and III, we will study simpletreemodel. Part IV includes suggestions for future study.
Part V shows how you can use other tools (QTreeWidget and QStandardItemModel)
to construct a similar tree.
Table of Contents
I:Models and Views
III: Making the tree model
Acknowledgments
This started as a direct translation of the online Qt
documentation on model-view programming. The main sources used were:
Also, thanks also to the folks at stackoverflow and qtcentre.org
for answering my many questions. Thanks also to Tim Doty, Anna Stenwick, and
Mark Summerfield for comments on previous drafts. Feel free to post questions/suggestions/comments in the comments of the relevant posts, or email them to me: thomson.eric at gmail.
References
Summerfield, M (2008) Rapid Gui Programming with Python and Qt. Prentice Hall.Summerfield, M (2010) Advanced Qt Programming. Prentice Hall.
2 comments:
Great code walk-through, thanks a lot :)
Hello Eric,I'm a non-prigrammer trying to write asimple GUI. I got stuck, but your post really helped me out. Very clearly explained for a visual thinking newbie like me.
Thanks!
Post a Comment