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
QMetaProperty.__init__ (self)
QMetaProperty.__init__ (self, QMetaProperty)
QMetaEnum QMetaProperty.enumerator (self)
[
返回枚举,如果这个属性的类型是一个枚举类型,否则返回的值是不确定的。
]($docs-qmetaenum.html)
See also isEnumType()和isFlagType( ) 。
bool QMetaProperty.hasNotifySignal (self)
返回True如果此属性有相应的变化通知信号,否则返回False 。
See also notifySignal( ) 。
bool QMetaProperty.hasStdCppSet (self)
bool QMetaProperty.isConstant (self)
返回True如果该属性是不变的,否则返回False 。
属性是恒定的,如果Q_PROPERTY()
的CONSTANT
属性被设置。
此功能被引入Qt的4.6 。
bool QMetaProperty.isDesignable (self, QObject object = None)
返回True如果此属性是可设计为给定的object否则返回False 。
如果没有object给出时,函数返回False ,如果Q_PROPERTY()
的DESIGNABLE
属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。
See also isScriptable()和isStored( ) 。
bool QMetaProperty.isEditable (self, QObject object = None)
bool QMetaProperty.isEnumType (self)
返回True ,如果属性的类型是一个枚举值,否则返回False 。
See also enumerator()和isFlagType( ) 。
bool QMetaProperty.isFinal (self)
返回True如果该属性是最终的,否则返回False 。
属性是最终的,如果Q_PROPERTY()
的FINAL
属性被设置。
此功能被引入Qt的4.6 。
bool QMetaProperty.isFlagType (self)
返回True ,如果属性的类型是作为一个标志枚举值,否则返回False 。
标志可以使用OR运算符进行组合。一个标志类型是隐式也是一个枚举类型。
See also isEnumType( )enumerator()和QMetaEnum.isFlag( ) 。
bool QMetaProperty.isReadable (self)
返回True如果此属性是可读的,否则返回False 。
See also isWritable( )read()和isValid( ) 。
bool QMetaProperty.isResettable (self)
返回True如果此属性可以重置为默认值,否则返回False 。
See also reset( ) 。
bool QMetaProperty.isScriptable (self, QObject object = None)
返回True,如果属性是可编写脚本对于给定的object否则返回False 。
如果没有object给出时,函数返回False ,如果Q_PROPERTY()
的SCRIPTABLE
属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。
See also isDesignable()和isStored( ) 。
bool QMetaProperty.isStored (self, QObject object = None)
返回True如果该属性用于存储object否则返回False 。
如果没有object给出时,函数返回False ,如果Q_PROPERTY()
的STORED
属性为False ,否则返回True (如果属性为True或者是一个函数或表达式) 。
See also isDesignable()和isScriptable( ) 。
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( ) 。
bool QMetaProperty.isValid (self)
返回True如果此属性是有效的(可读),否则返回False 。
See also isReadable( ) 。
bool QMetaProperty.isWritable (self)
返回True如果此属性为可写,否则返回False 。
See also isReadable()和write( ) 。
str QMetaProperty.name (self)
返回此属性的名称。
QMetaMethod QMetaProperty.notifySignal (self)
返回QMetaMethod属性更改通知信号的实例,如果已指定,否则返回一个无效的QMetaMethod。
此功能被引入Qt的4.5 。
See also hasNotifySignal( ) 。
int QMetaProperty.notifySignalIndex (self)
返回如果指定了属性更改通知信号的索引,否则返回-1 。
此功能被引入Qt的4.6 。
See also hasNotifySignal( ) 。
int QMetaProperty.propertyIndex (self)
返回此属性的索引。
此功能被引入Qt的4.6 。
QVariant QMetaProperty.read (self, QObject obj)
从给定的读取属性的值object。返回值,如果它能够读取它,否则返回一个无效的变体。
See also write( )reset()和isReadable( ) 。
bool QMetaProperty.reset (self, QObject obj)
将属性重置为给定的object用reset方法。返回True如果工作过的复位,否则返回False 。
复位方法是可选的,只有少数的属性支持他们。
Type QMetaProperty.type (self)
返回此属性的类型。返回值是的值之一QVariant.Type枚举。
See also userType( )typeName()和name( ) 。
str QMetaProperty.typeName (self)
返回此属性的类型的名称。
int QMetaProperty.userType (self)
返回此属性的用户类型。返回值是已注册的价值观之一QMetaType,或者0,如果类型未注册。
这个函数中引入了Qt 4.2中。
See also type( )QMetaType和typeName( ) 。
bool QMetaProperty.write (self, QObject obj, QVariant value)
Writes value作为该属性的值设置为给定object。返回True ,如果写入成功,否则返回False 。
See also read( )reset()和isWritable( ) 。