User Interface Compiler (uic)
本页面记录了 User Interface Compiler 关于 Qt Widgets.ui 模块。uic 会读取由 Qt Widgets Designer 生成的XML格式用户界面定义(xml-ph-0001@deepl.internal)文件,并生成相应的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 指令的生成。 |
--postfix <postfix> | 要添加到所有生成的类名后的后缀。 |
--tr, --translate <function> | 使用 <function> 进行国际化处理。 |
--include <include-file> | 在 <file> 中添加 #include <include-file>。 |
-g, --generator <python|cpp> | 选择生成器。 |
-c, --connections <pmf|string> | 连接语法。 |
--idbased | 使用基于 id 的函数进行 i18n |
--from-imports | Python:生成相对于 '.' 的导入路径 |
--absolute-imports | Python:生成相对于 '.' 的导入语句 |
--rc-prefix | Python:生成“rc_file”而非“file_rc”导入 |
--star-imports | Python:使用 * 导入 |
--python-paths <pathlist> | --absolute-imports 的Python路径。 |
用法
请参阅《在 C++ 应用程序中使用Qt Widgets Designer UI 文件》或《在Qt for Python 应用程序中使用Qt Widgets Designer UI 文件》。
© 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.