Using the MVC model on Qt Creator

While the preceding example showed how we can apply the MVC model to a tree view entirely in C++, let's check out how we can do the same with the widgets in Qt Designer. There are several widgets in Qt Creator that can be used with the MVC design pattern; they are called the model-based item views:

  • List View
  • Tree View
  • Table View
  • Column View
  • Undo View

They are all very similar, except the way they are presented to the user. These widgets are where the controller and view are implemented. The controller (or sometimes called delegate) is where the logic is applied, such as the rules of interaction between the presentation layer (view) and the data layer (model). For example, we can make a table editable via ...

Get Application Development with Qt Creator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.