Qt Quick 中的重要概念——数据——模型、视图和数据存储
大多数应用程序都会包含需要向用户展示的数据。这些数据可能来自多种来源:网络源、本地文件和数据库都是常见的数据来源。
模型与视图
在应用程序中,以相似的方式展示相似的数据通常很有优势,这催生了“模型”和“视图”的概念:模型用于存储数据,视图则用于展示数据。视图会为模型中的每个数据项显示一个委托对象。
有关Qt Quick 中如何实现模型/视图范式的信息,请参阅 Qt Quick 中标题为“模型与视图”的页面。
数据存储与访问
数据库通常用于在应用程序中存储信息,Qt 包含可访问 SQL 数据库的模型。若需简单访问 SQLite 存储,Qt Quick 提供了QtQuick.LocalStorage 模块。
© 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.