Using a data model for database access

There are two classes that can be used in accessing the database. These are the QSqlTableModel and QSqlQueryModel classes. The QSqlQueryModel class only provides a read-only model to the database. QSqlTableModel provides both read and write model access to the database.

In application development, you are confronted with the challenge of how to present data and to maintain a relationship between data and presentation (view) such that changes to the data are reflected in the view.

In the early days of the PHP language, data, presentation, and business logic were all jumbled up in one or more scripts. This made debugging and eventual code maintenance a nightmare. This same dilemma does crop up from time ...

Get Getting Started with Qt 5 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.