Pages

Item views

The chapter 10 of C++ GUI Programming with Qt 4, Second Edition is dedicated to the classes used for displaying data in Qt.

Basically, there are two families of classes that couls be used for this task, the *Widget (QListWidget, QTableWidget, QTreeWidget) ones are simpler, and require to be feeded with the items we want to show to the user. The data are owned directly by the class.

The *View classes (QListView, QTableView, QTreeView) use a more modern approach. It's a sort of Model-View-Controller (MVC) schema slightly modified to make lighter the Controller module - here called "Delegate". The Model takes care of the data management, the View is responsible for making the data available to the user, the Delegate make possible a custom control on the View using the Model. Usually, if our client require a "normal" behavior, we don't need to mess about with the delegate, since a default one would suffice.

I suggest you reading "C++ GUI Programming with Qt 4, Second Edition" by Jasmin Blanchette and Mark Summerfield for more details on the matter.

No comments:

Post a Comment