User Interface Compiler (uic)

本页记录了 User Interface Compiler模块的 Qt Widgets模块的文档。uic 读取由Qt Widgets Designer生成的 XML 格式用户界面定义 (.ui) 文件,并创建相应的 C++ 头文件或 Python 源文件。

使用方法:

uic [options] <uifile>

选项

下表列出了uic 可识别的命令行选项。

选项选项
-h, --help显示命令行选项的帮助。
-help-all显示包括 Qt 特定选项的帮助。
-v, --version显示版本信息。
-d, --dependencies显示依赖关系。
-o, --output <file>将输出放到 <file> 中
-a, --no-autoconnection不生成对 QObject::connectSlotsByName() 的调用。
-p, --no-protection禁用头文件保护。
-n, --no-implicit-includes禁用 #include-directives 的生成。
--postfix <postfix>将后缀添加到所有生成的类名中。
--tr, --translate <function>在 i18n 中使用 <function>。
--include <include-file>将 #include <include-file> 添加到 <file>。
-g, --generator <python|cpp>选择生成器。
-c, --connections <pmf|string>连接语法。
--idbased使用基于 id 的 i18n 函数
--from-importsPython:生成相对于".
--absolute-importsPython:生成绝对导入
--rc-prefixPython:生成绝对导入生成 "rc_file "而不是 "file_rc "导入
--star-importsPython:使用 * 导入
--python-paths <pathlist>绝对导入的 Python 路径。

使用方法

请参阅在 C++ 应用程序中使用 Designer UI 文件Qt for Python 应用程序中使用 Designer UI 文件

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