QDeclarativeItem Class Reference

[ QtDeclarative module]

The QDeclarativeItem class provides the most basic of all visual items in QML. 更多...

继承 QGraphicsObject and QDeclarativeParserStatus .

类型

方法


详细描述

The QDeclarativeItem class provides the most basic of all visual items in QML.

All visual items in Qt Declarative inherit from QDeclarativeItem. Although QDeclarativeItem has no visual appearance, it defines all the properties that are common across visual items - such as the x and y position, the width and height, anchoring and key handling.

You can subclass QDeclarativeItem to provide your own custom visual item that inherits these features. Note that, because it does not draw anything, QDeclarativeItem sets the QGraphicsItem.ItemHasNoContents flag. If you subclass QDeclarativeItem to create a visual item, you will need to unset this flag.


类型文档编制

QDeclarativeItem.TransformOrigin

Controls the point about which simple transforms like scale apply.

常量 描述
QDeclarativeItem.TopLeft 0 The top-left corner of the item.
QDeclarativeItem.Top 1 The center point of the top of the item.
QDeclarativeItem.TopRight 2 The top-right corner of the item.
QDeclarativeItem.Left 3 The left most point of the vertical middle.
QDeclarativeItem.Center 4 The center of the item.
QDeclarativeItem.Right 5 The right most point of the vertical middle.
QDeclarativeItem.BottomLeft 6 The bottom-left corner of the item.
QDeclarativeItem.Bottom 7 The center point of the bottom of the 项。
QDeclarativeItem.BottomRight 8 The bottom-right corner of the item.

方法文档编制

QDeclarativeItem.__init__ ( self , QDeclarativeItem   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

构造 QDeclarativeItem with the given parent .

float QDeclarativeItem.baselineOffset ( self )

QRectF QDeclarativeItem.boundingRect ( self )

QRectF QDeclarativeItem.childrenRect ( self )

QDeclarativeItem.classBegin ( self )

bool QDeclarativeItem.clip ( self )

QDeclarativeItem.componentComplete ( self )

bool QDeclarativeItem.event ( self , QEvent )

QDeclarativeItem.geometryChanged ( self , QRectF   newGeometry , QRectF   oldGeometry )

This function is called to handle this item's changes in geometry from oldGeometry to newGeometry . If the two geometries are the same, it doesn't do anything.

bool QDeclarativeItem.hasFocus ( self )

bool QDeclarativeItem.heightValid ( self )

Returns whether the height property has been set explicitly.

float QDeclarativeItem.implicitHeight ( self )

float QDeclarativeItem.implicitWidth ( self )

QDeclarativeItem.inputMethodEvent ( self , QInputMethodEvent )

QVariant QDeclarativeItem.inputMethodQuery ( self , Qt.InputMethodQuery   query )

bool QDeclarativeItem.isComponentComplete ( self )

Returns true if construction of the QML component is complete; otherwise returns false.

It is often desirable to delay some processing until the component is completed.

另请参阅 componentComplete ().

QVariant QDeclarativeItem.itemChange ( self , QGraphicsItem.GraphicsItemChange , QVariant)

bool QDeclarativeItem.keepMouseGrab ( self )

Returns a value indicating whether mouse input should remain with this item exclusively.

另请参阅 setKeepMouseGrab ().

QDeclarativeItem.keyPressEvent ( self , QKeyEvent   event )

QDeclarativeItem.keyReleaseEvent ( self , QKeyEvent   event )

QDeclarativeItem.paint ( self , QPainter , QStyleOptionGraphicsItem , QWidget )

QDeclarativeItem QDeclarativeItem.parentItem ( self )

bool QDeclarativeItem.sceneEvent ( self , QEvent )

QDeclarativeItem.setBaselineOffset ( self , float)

QDeclarativeItem.setClip ( self , bool)

QDeclarativeItem.setHeight ( self , float)

QDeclarativeItem.setImplicitHeight ( self , float)

Sets the implied height of the item to h . This is the height implied by other properties that determine the content.

另请参阅 implicitHeight ().

QDeclarativeItem.setImplicitWidth ( self , float)

Sets the implied width of the item to w . This is the width implied by other properties that determine the content.

另请参阅 implicitWidth ().

QDeclarativeItem.setKeepMouseGrab ( self , bool)

The flag indicating whether the mouse should remain with this item is set to keep .

This is useful for items that wish to grab and keep mouse interaction following a predefined gesture. For example, an item that is interested in horizontal mouse movement may set keepMouseGrab to true once a threshold has been exceeded. Once keepMouseGrab has been set to true, filtering items will not react to mouse events.

If the item does not indicate that it wishes to retain mouse grab, a filtering item may steal the grab. For example, Flickable may attempt to steal a mouse grab if it detects that the user has begun to move the viewport.

另请参阅 keepMouseGrab ().

QDeclarativeItem.setParentItem ( self , QDeclarativeItem   parent )

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

QDeclarativeItem.setSmooth ( self , bool)

QDeclarativeItem.setTransformOrigin ( self , TransformOrigin )

Set the transform origin .

另请参阅 transformOrigin ().

QDeclarativeItem.setWidth ( self , float)

bool QDeclarativeItem.smooth ( self )

TransformOrigin QDeclarativeItem.transformOrigin ( self )

Returns the current transform origin.

另请参阅 setTransformOrigin ().

bool QDeclarativeItem.widthValid ( self )

Returns whether the width property has been set explicitly.