PDA

View Full Version : difference between TreeWidget and TreeView



gauravg
12th March 2012, 12:18
please explain what is the difference between TreeWidget and TreeView


thanks with regards;
gauravg

Wolf900
12th March 2012, 12:47
"Widget" classes are convinience classes with fixed models good only for something very common and easy (text tables and such). If you want to subclass and have a flexible model, go for the "View" classes.

From http://qt-project.org/doc/qt-4.8/model-view-programming.html :


Convenience classes
A number of convenience classes are derived from the standard view classes for the benefit of applications that rely on Qt's item-based item view and table classes. They are not intended to be subclassed, but simply exist to provide a familiar interface to the equivalent classes in Qt 3. Examples of such classes include QListWidget, QTreeWidget, and QTableWidget; these provide similar behavior to the QListBox, QListView, and QTable classes in Qt 3.
These classes are less flexible than the view classes, and cannot be used with arbitrary models. We recommend that you use a model/view approach to handling data in item views unless you strongly need an item-based set of classes.
If you wish to take advantage of the features provided by the model/view approach while still using an item-based interface, consider using view classes, such as QListView, QTableView, and QTreeView with QStandardItemModel.