文件

使用文件模板将文件添加到项目中。

转到Project >Add New Item >Installed >Visual C++ >Qt 。

添加新项目对话框

模板添加
Qt .runsettings File在Qt Test Application 项目中添加 Qt .runsettings 文件。
Qt Class在应用程序项目中添加 Qt 类。
Qt Dialog Form File (Button Bottom)在Qt Widgets 应用程序项目中添加底部带有OK 和Cancel 按钮的对话框。
Qt Dialog Form File (Button Right)在Qt Widgets 应用程序项目中,对话框右边带有按钮。
Qt MainWindow Form FileQt Widgets 应用程序项目中的表单文件。
Qt QML FileQt Quick 应用程序项目的自定义 QML 类型。
Qt QML Module Definition指定Qt Quick Application 项目中使用的自定义 QML 类型的qmldir 文件。
Qt Resource File应用程序项目的 Qt 资源文件(.qrc)。
Qt Translation File应用程序项目的 Qt 翻译文件(.ts)。
Qt Widget Form File一个Qt Widgets 表单文件 (.ui) 到一个应用程序项目。
Qt Widgets Class在Qt Widgets 应用程序项目中添加Qt Widgets 类。

以下主题介绍了如何将不同类型的文件添加到项目中:

应用程序教程包含使用文件模板向项目添加文件的示例:

另请参见 项目。

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