QMetaProperty Class Reference

[QtCore module]

该QMetaProperty类提供的属性的元数据。More…

Methods

  • __init__ (self)
  • __init__ (self, QMetaProperty)
  • QMetaEnum enumerator (self)
  • bool hasNotifySignal (self)
  • bool hasStdCppSet (self)
  • bool isConstant (self)
  • bool isDesignable (self, QObject object = None)
  • bool isEditable (self, QObject object = None)
  • bool isEnumType (self)
  • bool isFinal (self)
  • bool isFlagType (self)
  • bool isReadable (self)
  • bool isResettable (self)
  • bool isScriptable (self, QObject object = None)
  • bool isStored (self, QObject object = None)
  • bool isUser (self, QObject object = None)
  • bool isValid (self)
  • bool isWritable (self)
  • str name (self)
  • QMetaMethod notifySignal (self)
  • int notifySignalIndex (self)
  • int propertyIndex (self)
  • QVariant read (self, QObject obj)
  • bool reset (self, QObject obj)
  • Type type (self)
  • str typeName (self)
  • int userType (self)
  • bool write (self, QObject obj, QVariant value)

Detailed Description

该QMetaProperty类提供的属性的元数据。

属性的元数据是从一个对象的元对象获得的。看QMetaObject.property()和QMetaObject.propertyCount( )了解详情。

Property Meta-Data

一个属性有name()和一个type() ,以及用于指定其行为的各种属性:isReadable( )isWritable( )isDesignable( )isScriptable()和isStored( ) 。

如果该属性是一个枚举,isEnumType( )返回True,如果属性是一个枚举,这也是一个标志(即它的值可以使用OR运算符进行组合) ,isEnumType()和isFlagType()都返回True。枚举这些类型可以从enumerator( ) 。

该属性的值设置和检索read( )write()和reset() ,它们也可以通过改变QObject的设置和获取功能。看QObject.setProperty()和QObject.property( )了解详情。

Copying and Assignment

QMetaProperty对象可以通过值被复制。然而,每个副本将引用相同的基础属性的元数据。


Method Documentation

  1. QMetaProperty.__init__ (self)
  1. QMetaProperty.__init__ (self, QMetaProperty)
  1. QMetaEnum QMetaProperty.enumerator (self)

[

返回枚举,如果这个属性的类型是一个枚举类型,否则返回的值是不确定的。

]($docs-qmetaenum.html)

See also isEnumType()和isFlagType( ) 。

  1. bool QMetaProperty.hasNotifySignal (self)

返回True如果此属性有相应的变化通知信号,否则返回False 。

See also notifySignal( ) 。

  1. bool QMetaProperty.hasStdCppSet (self)
  1. bool QMetaProperty.isConstant (self)

返回True如果该属性是不变的,否则返回False 。

属性是恒定的,如果Q_PROPERTY()CONSTANT属性被设置。

此功能被引入Qt的4.6 。

  1. bool QMetaProperty.isDesignable (self, QObject object = None)

返回True如果此属性是可设计为给定的object否则返回False 。

如果没有object给出时,函数返回False ,如果Q_PROPERTY()DESIGNABLE属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。

See also isScriptable()和isStored( ) 。

  1. bool QMetaProperty.isEditable (self, QObject object = None)
  1. bool QMetaProperty.isEnumType (self)

返回True ,如果属性的类型是一个枚举值,否则返回False 。

See also enumerator()和isFlagType( ) 。

  1. bool QMetaProperty.isFinal (self)

返回True如果该属性是最终的,否则返回False 。

属性是最终的,如果Q_PROPERTY()FINAL属性被设置。

此功能被引入Qt的4.6 。

  1. bool QMetaProperty.isFlagType (self)

返回True ,如果属性的类型是作为一个标志枚举值,否则返回False 。

标志可以使用OR运算符进行组合。一个标志类型是隐式也是一个枚举类型。

See also isEnumType( )enumerator()和QMetaEnum.isFlag( ) 。

  1. bool QMetaProperty.isReadable (self)

返回True如果此属性是可读的,否则返回False 。

See also isWritable( )read()和isValid( ) 。

  1. bool QMetaProperty.isResettable (self)

返回True如果此属性可以重置为默认值,否则返回False 。

See also reset( ) 。

  1. bool QMetaProperty.isScriptable (self, QObject object = None)

返回True,如果属性是可编写脚本对于给定的object否则返回False 。

如果没有object给出时,函数返回False ,如果Q_PROPERTY()SCRIPTABLE属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。

See also isDesignable()和isStored( ) 。

  1. bool QMetaProperty.isStored (self, QObject object = None)

返回True如果该属性用于存储object否则返回False 。

如果没有object给出时,函数返回False ,如果Q_PROPERTY()STORED属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。

See also isDesignable()和isScriptable( ) 。

  1. bool QMetaProperty.isUser (self, QObject object = None)

如果这个属性被指定为返回TrueUSER属性,即,使得用户能够编辑所述一个object或者说是某种其他方式显着。否则返回False 。例如,本text属性是USER一个可编辑的属性QLineEdit

If object为null,则函数返回False ,如果Q_PROPERTY()USER属性为False 。否则,它返回True 。

See also QMetaObject.userProperty( )isDesignable()和isScriptable( ) 。

  1. bool QMetaProperty.isValid (self)

返回True如果此属性是有效的(可读),否则返回False 。

See also isReadable( ) 。

  1. bool QMetaProperty.isWritable (self)

返回True如果此属性为可写,否则返回False 。

See also isReadable()和write( ) 。

  1. str QMetaProperty.name (self)

返回此属性的名称。

See also type()和typeName( ) 。

  1. QMetaMethod QMetaProperty.notifySignal (self)

返回QMetaMethod属性更改通知信号的实例,如果已指定,否则返回一个无效的QMetaMethod

此功能被引入Qt的4.5 。

See also hasNotifySignal( ) 。

  1. int QMetaProperty.notifySignalIndex (self)

返回如果指定了属性更改通知信号的索引,否则返回-1 。

此功能被引入Qt的4.6 。

See also hasNotifySignal( ) 。

  1. int QMetaProperty.propertyIndex (self)

返回此属性的索引。

此功能被引入Qt的4.6 。

  1. QVariant QMetaProperty.read (self, QObject obj)

从给定的读取属性的值object。返回值,如果它能够读取它,否则返回一个无效的变体。

See also write( )reset()和isReadable( ) 。

  1. bool QMetaProperty.reset (self, QObject obj)

将属性重置为给定的object用reset方法。返回True如果工作过的复位,否则返回False 。

复位方法是可选的,只有少数的属性支持他们。

See also read()和write( ) 。

  1. Type QMetaProperty.type (self)

返回此属性的类型。返回值是的值之一QVariant.Type枚举。

See also userType( )typeName()和name( ) 。

  1. str QMetaProperty.typeName (self)

返回此属性的类型的名称。

See also type()和name( ) 。

  1. int QMetaProperty.userType (self)

返回此属性的用户类型。返回值是已注册的价值观之一QMetaType,或者0,如果类型未注册。

这个函数中引入了Qt 4.2中。

See also type( )QMetaTypetypeName( ) 。

  1. bool QMetaProperty.write (self, QObject obj, QVariant value)

Writes value作为该属性的值设置为给定object。返回True ,如果写入成功,否则返回False 。

See also read( )reset()和isWritable( ) 。