书籍

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

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

主窗口显示与数据库中存储的书籍相关的信息

关于书籍集合的信息存储在数据库中。这些书籍按作者、书名、类型和出版年份进行分类。虽然每个字段都可以使用标准控件进行显示和编辑,但描述书籍任意评分的一个额外字段则需要一些额外的处理。

书籍的评分采用星级系统:每本书被分配一定数量的星级;星级越多,该书的评价越高。点击包含评分的单元格即可修改星级数量,数据库中的评分也会随之更新。

示例项目 @ code.qt.io

© 2026 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.