I guess I need to create a model class for each of my tables? (subclassing QAbstractModel). It will look like this :
class citiesTableModel : public QAbstractItemModel { Q_OBJECT }
citiesTableModel constructor will fetch data from the table in the database?
QAbstractItemModel *model = new citiesTableModel(); //model will contain 2 rows, New York and Seattle
Do I need to subclass QTableView for every different model?
class citiesTableView : public QTableView{}
- Finnaly, I guess that view.setData and view.setModel need to be reimplemented? setModel will loop over each model rows to build the QTableView, and setData will do proper query to add new data in the model?
submitAll
应该是QTableView
的成员吗?因为我找不到它。 - Paul-Sebastian Manolebool QSqlTableModel::submitAll () [slot]
- hank