PySide6.QtQml.ListProperty

class ListProperty

ListProperty 类允许应用程序将类似列表的属性暴露给 QML,这些属性属于从 QObject 派生的类。 使用方法在 Extending QML - Object and List Property Types ExampleExtending QML - Using List Property Types 示例中展示。

__init__(type, append, count=None, at=None, clear=None, removeLast=None, doc='', notify=None, designable=True, scriptable=True, stored=True, user=False, constant=False, final=False)
Parameters:
  • type (type) – 元素类型

  • append (callable) – 用于追加项目的函数

  • count (callable) – 一个返回列表计数的函数

  • at (可调用的) – 一个返回索引处项的函数

  • clear (callable) – 一个用于清空列表的函数

  • removeLast – 一个用于移除最后一项的函数

  • doc (str) – 文档字符串

  • notify (Signal) – 当发生更改时发出的信号

  • designable (bool) – 在QML中未使用

  • scriptable (bool) – 在QML中未使用

  • stored (bool) – 属性是否被存储

  • user (bool) – 在QML中未使用

  • constant (bool) – 属性是否为常量

  • final (bool) – 属性是否为最终属性