SQL 范例

Qt provides extensive database interoperability, with support for products from both open source and proprietary vendors.

SQL support is integrated with Qt's model/view architecture, making it easier to provide GUI integration for your database applications.

Books

Shows how to use Qt SQL classes with a model/view framework.

Cached Table Example

The Cached Table example shows how a table view can be used to access a database, caching any changes to the data until the user explicitly submits them using a push button.

Drill Down Example

The Drill Down example shows how to read data from a database as well as submit changes, using the QSqlRelationalTableModel and QDataWidgetMapper classes.

Master Detail Example

The Master Detail Example shows how to present data from different data sources in the same application. The album titles, and the corresponding artists and release dates, are kept in a database, while each album's tracks are stored in an XML file.

Query Model Example

The Query Model example shows how to make customized versions of data obtained from a SQL query, using a model that encapsulates the query and table views to display the results.

关系表模型范例

关系表模型示例展示如何使用表格视图与关系模型,可视化数据库中项之间的关系。

SQL Browser

The SQL Browser example shows how a data browser can be used to visualize the results of SQL statements on a live database.

SQL Widget Mapper Example

The SQL Widget Mapper example shows how to use a map information from a database to widgets on a form.

表格模型范例

The Table Model example shows how to use a specialized SQL table model with table views to edit information in a database.

Examples marked with an asterisk (*) are fully documented.