PySide6.QtDesigner.QPyDesignerCustomWidgetCollection

class QPyDesignerCustomWidgetCollection

概要

方法

详细描述

QPyDesignerCustomWidgetCollection 实现了 QDesignerCustomWidgetCollectionInterface 并通过类型或实现 QDesignerCustomWidgetInterface 提供了注册自定义小部件的静态辅助函数。

用法在Qt Widgets Designer中的自定义小部件中解释。

static registerCustomWidget(type[, xml=""[, tool_tip=""[, icon=""[, group=""[container=False]]]]])
Parameters:
  • xml (str) – 一段以.ui格式编写的XML代码片段,用于指定如何创建小部件并设置初始属性值。

  • tool_tip (str) – 在小部件框中显示的提示信息。

  • icon (str) – 在小部件框中显示的图标文件的路径。

  • group (str) – 用于在小部件框中分组小部件的类别。

  • module (str) – 用于通过uic生成导入代码的模块名称。

  • container (bool) – 指示该小部件是否是一个容器,如QGroupBox,即可以在其上放置子小部件。

通过类型将Python实现的QWidget实例注册到Qt Widgets Designer中。

可选的关键字参数对应于QDesignerCustomWidgetInterface的getter方法:

另请参阅

registerCustomWidget()

static addCustomWidget(custom_widget)
Parameters:

custom_widget (QDesignerCustomWidgetInterface) – 自定义小部件实例

添加一个自定义小部件(实现QDesignerCustomWidgetInterface)与Qt Widgets Designer