QDeclarativeItem Class Reference

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

  1. #include <QDeclarativeItem>

Inherits: QGraphicsObject and QDeclarativeParserStatus.

This class was introduced in Qt 4.7.

Detailed Description

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.

Public Types

Toggle detailsenum QDeclarativeItem::

TransformOriginTransformOrigin { TopLeft , Top , TopRight , Left , Center , Right , BottomLeft , Bottom , BottomRight 8 ...} { TopLeft , Top , TopRight , Left , Center , Right , BottomLeft , Bottom , BottomRight 8 }

Controls the point about which simple transforms like scale apply.

ConstantValueDescription
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 item.
QDeclarativeItem::BottomRight 8 The bottom-right corner of the item.

Look up this member in the source code.

    Properties

    Toggle detailsbaselineOffsetbaselineOffset : qreal

    This property holds The position of the item's baseline in local coordinates.

    The baseline of a Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text.

    For non-text items, a default baseline offset of 0 is used.

    Access functions:

    Look up this member in the source code.

    Toggle detailschildrenRectchildrenRect : const QRectF

    This property holds The geometry of an item's children.

    This property holds the (collective) position and size of the item's children.

    Access functions:

    Look up this member in the source code.

    Toggle detailsclipclip : bool

    This property holds whether clipping is enabled. The default clip value is false.

    If clipping is enabled, an item will clip its own painting, as well as the painting of its children, to its bounding rectangle. If you set clipping during an item's paint operation, remember to re-set it to prevent clipping the rest of your scene.

    Non-rectangular clipping regions are not supported for performance reasons.

    Access functions:

    Look up this member in the source code.

    Toggle detailsimplicitHeightimplicitHeight : const qreal

    Access functions:

    Look up this member in the source code.

    Toggle detailsimplicitWidthimplicitWidth : const qreal

    Access functions:

    Look up this member in the source code.

    Toggle detailsparentparent : QDeclarativeItem *

    This property holds the parent of the item.

    Access functions:

    Look up this member in the source code.

    Toggle detailssmoothsmooth : bool

    This property holds whether the item is smoothly transformed.

    This property is provided purely for the purpose of optimization. Turning smooth transforms off is faster, but looks worse; turning smooth transformations on is slower, but looks better.

    By default smooth transformations are off.

    Access functions:

    Look up this member in the source code.

      Public Functions

      Toggle details QDeclarativeItem

      QDeclarativeItemQDeclarativeItem ( QDeclarativeItem *parent=0 ) ( QDeclarativeItem *parent=0 )

      Constructs a QDeclarativeItem with the given parent.

      Look up this member in the source code.

      Toggle details QDeclarativeItem

      ~QDeclarativeItem~QDeclarativeItem () () [virtual]

      Destroys the QDeclarativeItem.

      Look up this member in the source code.

      Toggle details QDeclarativeItem * QDeclarativeItem

      childAtchildAt ( qreal x , qreal y ) ( qreal x , qreal y )const

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      forceActiveFocusforceActiveFocus () ()

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      geometryChangedgeometryChanged ( const QRectF &newGeometry , const QRectF &oldGeometry ...) ( const QRectF &newGeometry , const QRectF &oldGeometry ) [virtual protected]

      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.

      Look up this member in the source code.

      Toggle details bool QDeclarativeItem

      heightValidheightValid () ()const[protected]

      Returns whether the height property has been set explicitly.

      Look up this member in the source code.

      Toggle details bool QDeclarativeItem

      isComponentCompleteisComponentComplete () ()const[protected]

      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.

      See also componentComplete().

      Look up this member in the source code.

      Toggle details bool QDeclarativeItem

      keepMouseGrabkeepMouseGrab () ()const

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

      See also setKeepMouseGrab().

      Look up this member in the source code.

      Toggle details QScriptValue QDeclarativeItem

      mapFromItemmapFromItem ( const QScriptValue &item , qreal x , qreal y ...) ( const QScriptValue &item , qreal x , qreal y )const

      Look up this member in the source code.

      Toggle details QScriptValue QDeclarativeItem

      mapToItemmapToItem ( const QScriptValue &item , qreal x , qreal y ...) ( const QScriptValue &item , qreal x , qreal y )const

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      setImplicitHeightsetImplicitHeight ( qreal h ) ( qreal h )[protected]

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

      See also implicitHeight().

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      setImplicitWidthsetImplicitWidth ( qreal w ) ( qreal w )[protected]

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

      See also implicitWidth().

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      setKeepMouseGrabsetKeepMouseGrab ( bool keep ) ( bool keep )

      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.

      See also keepMouseGrab().

      Look up this member in the source code.

      Toggle details void QDeclarativeItem

      setTransformOriginsetTransformOrigin ( TransformOrigin origin ) ( TransformOrigin origin )

      Set the transform origin.

      See also transformOrigin().

      Look up this member in the source code.

      Toggle details TransformOrigin QDeclarativeItem

      transformOrigintransformOrigin () ()const

      Returns the current transform origin.

      See also setTransformOrigin().

      Look up this member in the source code.

      Toggle details bool QDeclarativeItem

      widthValidwidthValid () ()const[protected]

      Returns whether the width property has been set explicitly.

      Look up this member in the source code.

        Signals

        Toggle details QDeclarativeItem

        Q_REVISIONQ_REVISION () () [signal]

        Look up this member in the source code.

        Toggle details QDeclarativeItem

        Q_REVISIONQ_REVISION () () [signal]

        Look up this member in the source code.

          Notes provided by the Qt Community

          No notes