Qt UI Tools
Qt Widgets Designer 表单在运行时进行处理,以动态生成用户界面。为了在运行时生成表单,需要一个包含用户界面文件的资源文件。
QUiLoader 类提供的表单加载器对象用于构建用户界面。该用户界面可从任何QIODevice 上获取。例如,QFile 对象可用于获取存储在项目资源中的表单。QUiLoader::load() 函数获取文件中包含的用户界面描述,并构建表单部件。
使用模块
使用 Qt 模块的 C++ API 需要直接或通过其他依赖关系与模块库链接。包括CMake和qmake 在内的多个构建工具都为此提供了专门支持。
使用 CMake 构建
使用find_package()
命令在Qt6
软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS UiTools) target_link_libraries(mytarget PRIVATE Qt6::UiTools)
更多详情,请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置使用 qmake 构建的模块,请在项目的 .pro 文件中添加模块作为QT
变量的值:
QT += uitools
许可证和属性
示例
参考资料
许可证
Qt UI Tools 在商业许可下,可从Qt Company 购买。此外,它还可以在自由软件许可证下使用。自 Qt 6.0 起,这些自由软件许可证为GNU Lesser General Public License 第 3 版或GNU General Public License 第 2 版。更多详情,请参阅Qt 许可。
© 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.