QMetaProperty

Inheritance diagram of QMetaProperty

Synopsis

Functions

Detailed Description

The PySide.QtCore.QMetaProperty class provides meta-data about a property.

Property meta-data is obtained from an object’s meta-object. See QMetaObject.property() and QMetaObject.propertyCount() for details.

Property Meta-Data

A property has a PySide.QtCore.QMetaProperty.name() and a PySide.QtCore.QMetaProperty.type() , as well as various attributes that specify its behavior: PySide.QtCore.QMetaProperty.isReadable() , PySide.QtCore.QMetaProperty.isWritable() , PySide.QtCore.QMetaProperty.isDesignable() , PySide.QtCore.QMetaProperty.isScriptable() , and PySide.QtCore.QMetaProperty.isStored() .

If the property is an enumeration, PySide.QtCore.QMetaProperty.isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator), PySide.QtCore.QMetaProperty.isEnumType() and PySide.QtCore.QMetaProperty.isFlagType() both return true. The enumerator for these types is available from PySide.QtCore.QMetaProperty.enumerator() .

The property’s values are set and retrieved with PySide.QtCore.QMetaProperty.read() , PySide.QtCore.QMetaProperty.write() , and PySide.QtCore.QMetaProperty.reset() ; they can also be changed through PySide.QtCore.QObject ‘s set and get functions. See QObject.setProperty() and QObject.property() for details.

Copying and Assignment

PySide.QtCore.QMetaProperty objects can be copied by value. However, each copy will refer to the same underlying property meta-data.

class PySide.QtCore.QMetaProperty
class PySide.QtCore.QMetaProperty(QMetaProperty)
Parameters:QMetaPropertyPySide.QtCore.QMetaProperty
PySide.QtCore.QMetaProperty.enumerator()
Return type:PySide.QtCore.QMetaEnum

Returns the enumerator if this property’s type is an enumerator type; otherwise the returned value is undefined.

PySide.QtCore.QMetaProperty.hasNotifySignal()
Return type:PySide.QtCore.bool

Returns true if this property has a corresponding change notify signal; otherwise returns false.

PySide.QtCore.QMetaProperty.hasStdCppSet()
Return type:PySide.QtCore.bool

Returns true if the property has a C++ setter function that follows Qt’s standard “name” / “setName” pattern. Designer and uic query PySide.QtCore.QMetaProperty.hasStdCppSet() in order to avoid expensive QObject.setProperty() calls. All properties in Qt [should] follow this pattern.

PySide.QtCore.QMetaProperty.isConstant()
Return type:PySide.QtCore.bool

Returns true if the property is constant; otherwise returns false.

A property is constant if the Q_PROPERTY() ‘s CONSTANT attribute is set.

PySide.QtCore.QMetaProperty.isDesignable([obj=None])
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Returns true if this property is designable for the given object ; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY() ‘s DESIGNABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

PySide.QtCore.QMetaProperty.isEditable([obj=None])
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Returns true if the property is editable for the given object ; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY() ‘s EDITABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

PySide.QtCore.QMetaProperty.isEnumType()
Return type:PySide.QtCore.bool

Returns true if the property’s type is an enumeration value; otherwise returns false.

PySide.QtCore.QMetaProperty.isFinal()
Return type:PySide.QtCore.bool

Returns true if the property is final; otherwise returns false.

A property is final if the Q_PROPERTY() ‘s FINAL attribute is set.

PySide.QtCore.QMetaProperty.isFlagType()
Return type:PySide.QtCore.bool

Returns true if the property’s type is an enumeration value that is used as a flag; otherwise returns false.

Flags can be combined using the OR operator. A flag type is implicitly also an enum type.

PySide.QtCore.QMetaProperty.isReadable()
Return type:PySide.QtCore.bool

Returns true if this property is readable; otherwise returns false.

PySide.QtCore.QMetaProperty.isResettable()
Return type:PySide.QtCore.bool

Returns true if this property can be reset to a default value; otherwise returns false.

PySide.QtCore.QMetaProperty.isScriptable([obj=None])
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Returns true if the property is scriptable for the given object ; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY() ‘s SCRIPTABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

PySide.QtCore.QMetaProperty.isStored([obj=None])
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Returns true if the property is stored for object ; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY() ‘s STORED attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

PySide.QtCore.QMetaProperty.isUser([obj=None])
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Returns true if this property is designated as the USER property, i.e., the one that the user can edit for object or that is significant in some other way. Otherwise it returns false. e.g., the text property is the USER editable property of a PySide.QtGui.QLineEdit .

If object is null, the function returns false if the Q_PROPERTY() ‘s USER attribute is false. Otherwise it returns true.

PySide.QtCore.QMetaProperty.isValid()
Return type:PySide.QtCore.bool

Returns true if this property is valid (readable); otherwise returns false.

PySide.QtCore.QMetaProperty.isWritable()
Return type:PySide.QtCore.bool

Returns true if this property is writable; otherwise returns false.

PySide.QtCore.QMetaProperty.name()
Return type:str

Returns this property’s name.

PySide.QtCore.QMetaProperty.notifySignal()
Return type:PySide.QtCore.QMetaMethod

Returns the PySide.QtCore.QMetaMethod instance of the property change notifying signal if one was specified, otherwise returns an invalid PySide.QtCore.QMetaMethod .

PySide.QtCore.QMetaProperty.notifySignalIndex()
Return type:PySide.QtCore.int

Returns the index of the property change notifying signal if one was specified, otherwise returns -1.

PySide.QtCore.QMetaProperty.propertyIndex()
Return type:PySide.QtCore.int

Returns this property’s index.

PySide.QtCore.QMetaProperty.read(obj)
Parameters:objPySide.QtCore.QObject
Return type:object

Reads the property’s value from the given object . Returns the value if it was able to read it; otherwise returns an invalid variant.

PySide.QtCore.QMetaProperty.reset(obj)
Parameters:objPySide.QtCore.QObject
Return type:PySide.QtCore.bool

Resets the property for the given object with a reset method. Returns true if the reset worked; otherwise returns false.

Reset methods are optional; only a few properties support them.

PySide.QtCore.QMetaProperty.type()
Return type:PySide.QtCore.QVariant::Type

Returns this property’s type. The return value is one of the values of the QVariant.Type enumeration.

PySide.QtCore.QMetaProperty.typeName()
Return type:str

Returns the name of this property’s type.

PySide.QtCore.QMetaProperty.userType()
Return type:PySide.QtCore.int

Returns this property’s user type. The return value is one of the values that are registered with QMetaType , or 0 if the type is not registered.

PySide.QtCore.QMetaProperty.write(obj, value)
Parameters:
Return type:

PySide.QtCore.bool

Writes value as the property’s value to the given object . Returns true if the write succeeded; otherwise returns false.