创建Qt Quick 应用程序
您可以创建包含 QML 和 C++ 代码的Qt Quick 应用程序。构建应用程序并将其部署到桌面、嵌入式和移动目标平台。
创建Qt Quick 应用程序项目:
- 转到File >New Project >Application (Qt) > 。 Qt Quick Application.
注: 要使用qmake作为构建系统、使用 Qt 5 进行开发或为应用程序添加翻译,请选择 Qt Quick Application (compat).
- 选择Choose ,打开Project Location 对话框。
- 在Name 中,输入项目名称。请记住,以后不能轻易更改项目名称。
- 在Create in 中,输入项目文件的路径。选择Use as default project location 默认在此文件夹中创建新项目。以后可以移动项目文件夹,不会出现问题。
- 选择Next 打开Define Project Details 对话框。
- 选择 Use Qt Virtual Keyboard以在应用程序中添加对 Qt Virtual Keyboard的支持。
注意: 如果在安装 Qt 时没有安装Qt Virtual Keyboard 模块,则在尝试打开Main.qml进行编辑时会出现错误信息。您可以使用 Qt Online Installer来安装Qt Virtual Keyboard 。
- 在Minimum required Qt version 中选择要使用的 Qt 版本进行开发。Qt 版本决定了 QML 文件中使用的Qt Quick 导入。
- 选择Next ,打开Kit Selection 对话框。
- 为要构建应用程序的平台选择工具包。
- 选择Next 打开Project Management 对话框。
- 查看项目设置,然后选择Finish (在 Windows 和 Linux 上)或Done (在 macOS 上)创建项目。
Qt Creator 创建一个 QML 文件Main.qml,您可以在 模式下修改该文件。Edit
另请参阅 创建Qt Quick UI 原型、教程:移动应用程序》、《教程:Qt Quick 和 Python》、《教程:Qt Quick 应用程序》、《创建项目》和《开发Qt Quick 应用程序》。
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.