QML 高级教程
本教程将逐步讲解如何使用 QML 创建一个完整的应用程序。本教程假定您已了解 QML 的基础知识(例如,通过阅读简单教程)。
在本教程中,我们将根据声明examples
目录中的Same Game 应用程序编写一个游戏 Same Game,它看起来像这样:
我们将介绍制作一个全功能应用程序的概念,包括 JavaScript 集成、使用 QML Qt Quick States和Behaviors 来管理组件和增强界面,以及存储持久应用程序数据。
了解 JavaScript 有助于理解本教程的部分内容,但如果你不了解 JavaScript,也可以了解如何集成后台逻辑来创建和控制 QML 类型。
教程章节
本教程中的所有代码均可在 Qt 的examples/quick/tutorials/samegame
目录中找到。
© 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.