创建Qt Interface Framework 项目
使用 Qt Interface Framework 工具和核心 API 来实现中间件 API、后端及服务。借助Qt Interface Framework Generator,您可以使用 QFace 接口定义语言 (IDL) 来定义新的 API,并生成 Qt C++ 类和 Qml 类型。
Qt Interface Framework 由以下部分组成:
- 核心模块,其中包含您所创建的所有 API 的基类和通用代码。
- 针对某项功能的前端 API。
- 该功能的前端接口,以及一个或多个实现该接口的后端,用于连接底层服务或其模拟环境。
为了能够复用先前项目的代码,同时整合多个团队开发的代码,Qt Interface Framework 功能API被划分为两层:前端和后端。您可以将一个前端连接到多个后端,因为核心模块可以轻松找到相应的后端。
要为包含前端和后端的功能创建一个Qt Interface Framework 项目:
- 前往File >New Project >Other Project ,然后选择 Qt Interface Framework Project。
- 指定应用程序的名称和位置。
- 选择“Next ”。
- 在“Project name ”中,输入项目名称。

- 在“Interface name ”中,输入描述该功能前端和后端之间交换数据的接口名称。
- 选择“Add sample code to the project ”以生成该项目的模板代码。
- 选择“Generate a zoned interface ”以创建一个用于多个控制点的 API,例如操作汽车的车窗、后视镜和空调。
- 在“Backend setup ”中,选择用于生成后端的选项。
- 选择“Next ”以选择用于构建和运行项目的套件。
- 选择“Next ”以创建该项目。
修改项目中的模板代码以实现某项功能。
另请参阅 《操作指南:创建项目》。
Copyright © The Qt Company Ltd. and other contributors. 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.