Re: QT Model/View questions
For the most flexibility, you should be looking at the QTreeView class, not QTreeWidget for starters. The Q*Widget classes are convenience classes but the Q*View classes and model classes derived from QAbstractItemModel offer the most flexibility.
For the model, you can use any of the Qt built-in Qt models if they fit your data structure needs well, but for complex data structures, you'll want to derive your own model from QAbstractItemModel and likely also a QSortFilterProxyModel as well if you have sorting and/or filtering needs, which are common requirements.
To give you one quick example, my first use/attempt at a Qt Model/View implementation used QStandardItemModel. The sorting of a few thousand records became an issue, so I re-implemented using my own model I derived from QAbstractItemModel and QSortFilterProxyModel and the sorting became sub-second for the same number of items.
So, if you really want to learn Qt model/view programming, either avoid the Widget classes (my opinion), or at least understand why you'd choose them over the View/Model classes that provide more flexibility, etc.
Hope that helps.
I write the best type of code possible, code that I want to write, not code that someone tells me to write!
Bookmarks