I am trying to design an MVC-pattern with PyQt. I want to split all programs into 3 parts:
Yes, PyQt uses Model/View concept (officially without the "Controller" part), but may be you have a somewhat distorted picture what does it mean in PyQt.
There are two parts:
QAbstractItemModel
, QAbstractTableModel
, QAbstractListModel
, etc.). These models can talk to your data sources directly (files, databases), or proxy your own PyQt-agnostic models which were written before.QTreeView
, QTableView
and others). Even some simpler controls, like QComboBox
can act as a view for a PyQt model.All other parts of you application, which react to signals, etc. may be considered as "Controller".
PyQt also provides a set of predefined "universal" models which can be subclassed or used directly if you need only simple functionality from the model, like QStringListModel
, QStandardItemModel
, etc. And there are also models which can talk to databases directly, like QSqlTableModel
.