书籍

展示如何在模型/视图框架中使用Qt SQL 类。

Books 示例展示了如何将 Qt 的 SQL 类与模型/视图框架结合使用,为存储在数据库中的信息创建丰富的用户界面。

数据库中保存了一系列书籍的信息。书籍按作者、标题、流派和出版年份编目。虽然这些字段都可以使用标准部件来显示和编辑,但描述图书任意评分的附加字段还需要一些额外的东西。

图书的评分系统为每本书都分配了一定数量的星星;星星越多,说明这本书越好。通过点击包含评分的单元格,可以修改星数,并更新数据库中的评分。

示例项目 @ code.qt.io

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.