QDeclarativeProperty

概要

静态函数

  • def read (arg__1, arg__2)
  • def read (arg__1, arg__2, arg__3)
  • def read (arg__1, arg__2, arg__3)
  • def write (arg__1, arg__2, arg__3)
  • def write (arg__1, arg__2, arg__3, arg__4)
  • def write (arg__1, arg__2, arg__3, arg__4)

详细描述

PySide.QtDeclarative.QDeclarativeProperty class abstracts accessing properties on objects created from QML.

As QML uses Qt's meta-type system all of the existing PySide.QtCore.QMetaObject classes can be used to introspect and interact with objects created by QML. However, some of the new features provided by QML - such as type safety and attached properties - are most easily used through the PySide.QtDeclarative.QDeclarativeProperty class that simplifies some of their natural complexity.

不像 PySide.QtCore.QMetaProperty which represents a property on a class type, PySide.QtDeclarative.QDeclarativeProperty encapsulates a property on a specific object instance. To read a property's value, programmers create a PySide.QtDeclarative.QDeclarativeProperty instance and call the PySide.QtDeclarative.QDeclarativeProperty.read() method. Likewise to write a property value the PySide.QtDeclarative.QDeclarativeProperty.write() method is used.

For example, for the following QML code:

// MyItem.qml
import QtQuick 1.0
Text { text: "A bit of text" }
									

文本 object's properties could be accessed using PySide.QtDeclarative.QDeclarativeProperty , like this:

#include <QDeclarativeProperty>
#include <QGraphicsObject>
...
QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml"));
QDeclarativeProperty property(view.rootObject(), "font.pixelSize");
qWarning() << "Current pixel size:" << property.read().toInt();
property.write(24);
qWarning() << "Pixel size should now be 24:" << property.read().toInt();
									
class PySide.QtDeclarative. QDeclarativeProperty
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 , arg__2 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 , arg__2 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 , arg__2 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 , arg__2 , arg__3 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 , arg__2 , arg__3 )
class PySide.QtDeclarative. QDeclarativeProperty ( arg__1 )
参数:

Create an invalid PySide.QtDeclarative.QDeclarativeProperty .

创建 PySide.QtDeclarative.QDeclarativeProperty for the default property of obj . If there is no default property, an invalid PySide.QtDeclarative.QDeclarativeProperty will be created.

创建 PySide.QtDeclarative.QDeclarativeProperty for the default property of obj 使用 context ctxt . If there is no default property, an invalid PySide.QtDeclarative.QDeclarativeProperty will be created.

创建 PySide.QtDeclarative.QDeclarativeProperty for the default property of obj using the environment for instantiating QML components that is provided by engine . If there is no default property, an invalid PySide.QtDeclarative.QDeclarativeProperty will be created.

创建 PySide.QtDeclarative.QDeclarativeProperty for the property name of obj .

创建 PySide.QtDeclarative.QDeclarativeProperty for the property name of obj 使用 context ctxt .

Creating a PySide.QtDeclarative.QDeclarativeProperty without a context will render some properties - like attached properties - inaccessible.

创建 PySide.QtDeclarative.QDeclarativeProperty for the property name of obj using the environment for instantiating QML components that is provided by engine .

Create a copy of other .

PySide.QtDeclarative.QDeclarativeProperty. Type

This enum specifies a type of QML property.

常量 描述
QDeclarativeProperty.Invalid The property is invalid.
QDeclarativeProperty.Property The property is a regular Qt property.
QDeclarativeProperty.SignalProperty The property is a signal property.
PySide.QtDeclarative.QDeclarativeProperty. PropertyTypeCategory

This enum specifies a category of QML property.

常量 描述
QDeclarativeProperty.InvalidCategory The property is invalid, or is a signal property.
QDeclarativeProperty.List The property is a QDeclarativeListProperty list property
QDeclarativeProperty.Object The property is a PySide.QtCore.QObject derived type pointer
QDeclarativeProperty.Normal The property is a normal value property.
PySide.QtDeclarative.QDeclarativeProperty. connectNotifySignal ( dest , method )
参数:
返回类型:

PySide.QtCore.bool

Connects the property's change notifier signal to the specified method of the dest object and returns true. Returns false if this metaproperty does not represent a regular Qt property or if it has no change notifier signal, or if the dest object does not have the specified method .

PySide.QtDeclarative.QDeclarativeProperty. connectNotifySignal ( dest , slot )
参数:
返回类型:

PySide.QtCore.bool

Connects the property's change notifier signal to the specified slot of the dest object and returns true. Returns false if this metaproperty does not represent a regular Qt property or if it has no change notifier signal, or if the dest object does not have the specified slot .

PySide.QtDeclarative.QDeclarativeProperty. hasNotifySignal ( )
返回类型: PySide.QtCore.bool

Returns true if the property has a change notifier signal, otherwise false.

PySide.QtDeclarative.QDeclarativeProperty. index ( )
返回类型: PySide.QtCore.int

Return the Qt metaobject index of the property.

PySide.QtDeclarative.QDeclarativeProperty. isDesignable ( )
返回类型: PySide.QtCore.bool

Returns true if the property is designable, otherwise false.

PySide.QtDeclarative.QDeclarativeProperty. isProperty ( )
返回类型: PySide.QtCore.bool

返回 true,若此 PySide.QtDeclarative.QDeclarativeProperty represents a regular Qt property.

PySide.QtDeclarative.QDeclarativeProperty. isResettable ( )
返回类型: PySide.QtCore.bool

Returns true if the property is resettable, otherwise false.

PySide.QtDeclarative.QDeclarativeProperty. isSignalProperty ( )
返回类型: PySide.QtCore.bool

返回 true,若此 PySide.QtDeclarative.QDeclarativeProperty represents a QML signal property.

PySide.QtDeclarative.QDeclarativeProperty. isValid ( )
返回类型: PySide.QtCore.bool

返回 true 若 PySide.QtDeclarative.QDeclarativeProperty refers to a valid property, otherwise false.

PySide.QtDeclarative.QDeclarativeProperty. isWritable ( )
返回类型: PySide.QtCore.bool

Returns true if the property is writable, otherwise false.

PySide.QtDeclarative.QDeclarativeProperty. method ( )
返回类型: PySide.QtCore.QMetaMethod

返回 PySide.QtCore.QMetaMethod for this property if it is a SignalProperty , otherwise returns an invalid PySide.QtCore.QMetaMethod .

PySide.QtDeclarative.QDeclarativeProperty. name ( )
返回类型: unicode

Return the name of this QML property.

PySide.QtDeclarative.QDeclarativeProperty. needsNotifySignal ( )
返回类型: PySide.QtCore.bool

Returns true if the property needs a change notifier signal for bindings to remain upto date, false otherwise.

Some properties, such as attached properties or those whose value never changes, do not require a change notifier.

PySide.QtDeclarative.QDeclarativeProperty. object ( )
返回类型: PySide.QtCore.QObject

返回 PySide.QtDeclarative.QDeclarativeProperty ‘s PySide.QtCore.QObject .

PySide.QtDeclarative.QDeclarativeProperty. __eq__ ( arg__1 )
参数: arg__1 PySide.QtDeclarative.QDeclarativeProperty
返回类型: PySide.QtCore.bool

Returns true if other and this PySide.QtDeclarative.QDeclarativeProperty represent the same property.

PySide.QtDeclarative.QDeclarativeProperty. property ( )
返回类型: PySide.QtCore.QMetaProperty

返回 Qt property associated with this QML property.

PySide.QtDeclarative.QDeclarativeProperty. propertyType ( )
返回类型: PySide.QtCore.int

返回 PySide.QtCore.QVariant type of the property, or QVariant.Invalid if the property has no PySide.QtCore.QVariant 类型。

PySide.QtDeclarative.QDeclarativeProperty. propertyTypeCategory ( )
返回类型: PySide.QtDeclarative.QDeclarativeProperty.PropertyTypeCategory

Returns the property category.

PySide.QtDeclarative.QDeclarativeProperty. propertyTypeName ( )
返回类型: str

Returns the type name of the property, or 0 if the property has no type name.

static PySide.QtDeclarative.QDeclarativeProperty. read ( arg__1 , arg__2 , arg__3 )
参数:
返回类型:

object

返回 name property value of object using the environment for instantiating QML components that is provided by engine . . This method is equivalent to:

QDeclarativeProperty p(object, name, engine);
p.read();
										
static PySide.QtDeclarative.QDeclarativeProperty. read ( arg__1 , arg__2 , arg__3 )
参数:
返回类型:

object

返回 name property value of object 使用 context ctxt . This method is equivalent to:

QDeclarativeProperty p(object, name, context);
p.read();
										
static PySide.QtDeclarative.QDeclarativeProperty. read ( arg__1 , arg__2 )
参数:
返回类型:

object

返回 name property value of object . This method is equivalent to:

QDeclarativeProperty p(object, name);
p.read();
										
PySide.QtDeclarative.QDeclarativeProperty. read ( )
返回类型: object

Returns the property value.

PySide.QtDeclarative.QDeclarativeProperty. reset ( )
返回类型: PySide.QtCore.bool

Resets the property and returns true if the property is resettable. If the property is not resettable, nothing happens and false is returned.

PySide.QtDeclarative.QDeclarativeProperty. type ( )
返回类型: PySide.QtDeclarative.QDeclarativeProperty.Type

Returns the type of the property.

static PySide.QtDeclarative.QDeclarativeProperty. write ( arg__1 , arg__2 , arg__3 , arg__4 )
参数:
返回类型:

PySide.QtCore.bool

写入 value name property of object using the environment for instantiating QML components that is provided by engine . This method is equivalent to:

QDeclarativeProperty p(object, name, engine);
p.write(value);
										
static PySide.QtDeclarative.QDeclarativeProperty. write ( arg__1 , arg__2 , arg__3 )
参数:
返回类型:

PySide.QtCore.bool

写入 value name property of object . This method is equivalent to:

QDeclarativeProperty p(object, name);
p.write(value);
										
PySide.QtDeclarative.QDeclarativeProperty. write ( arg__1 )
参数: arg__1 – object
返回类型: PySide.QtCore.bool

Sets the property value to value and returns true. Returns false if the property can't be set because the value is the wrong type, for example.

static PySide.QtDeclarative.QDeclarativeProperty. write ( arg__1 , arg__2 , arg__3 , arg__4 )
参数:
返回类型:

PySide.QtCore.bool

写入 value name property of object 使用 context ctxt . This method is equivalent to:

QDeclarativeProperty p(object, name, ctxt);
p.write(value);