使用样式表编辑资源Qt Widgets Designer
Qt Widgets Designer Qt Designer 完全支持Qt 资源系统(Qt Resource System),可在设计窗体时将资源与窗体一起指定。为了帮助设计人员和开发人员管理应用程序的资源, 的资源编辑器允许按表单定义资源。换句话说,每个窗体都可以有一个单独的资源文件。Qt Widgets Designer
定义资源文件
要指定资源文件,必须打开 "工具"菜单,打开 "资源浏览器"选项,启用资源编辑器。
![]() | 资源文件 在资源浏览器中,您可以打开现有的资源文件或创建新文件。单击 "编辑资源"按钮 |
加载资源文件后,可以使用给定的 "添加文件"(Add Files) 和 "删除文件"(Remove Files)
按钮创建或删除其中的条目,还可以使用 "添加文件"(Add Files)按钮
指定资源(如图像)。请注意,这些资源必须位于当前资源文件的目录或其子目录中。
![]() | 编辑资源文件 按 在资源编辑器中选择相应条目,然后按 |
使用资源
一旦定义了资源,您就可以在创建表格时积极使用它们。例如,您可能想使用资源文件中指定的图标创建一个工具按钮。
![]() | 使用资源 在使用资源文件中定义的值更改属性时,Qt Widgets Designer 的属性编辑器除了允许您以普通方式选择源文件外,还允许您指定资源。 |
![]() | 选择资源 在设计过程中,您可以随时单击 "选择资源..."(Choose Resource...)打开资源选择器,添加资源。 |
© 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.