Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QDeclarativeItem Class Reference

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

 #include <QDeclarativeItem>

Inherits: QGraphicsObject and QDeclarativeParserStatus.

This class was introduced in Qt 4.7.

Public Types

enum TransformOrigin { TopLeft, Top, TopRight, Left, ..., BottomRight }

Properties

Public Functions

QDeclarativeItem ( QDeclarativeItem * parent = 0 )
virtual ~QDeclarativeItem ()
qreal baselineOffset () const
QDeclarativeItem * childAt ( qreal x, qreal y ) const
QRectF childrenRect ()
bool clip () const
void forceActiveFocus ()
qreal implicitHeight () const
qreal implicitWidth () const
bool keepMouseGrab () const
QScriptValue mapFromItem ( const QScriptValue & item, qreal x, qreal y ) const
QScriptValue mapToItem ( const QScriptValue & item, qreal x, qreal y ) const
QDeclarativeItem * parentItem () const
void setBaselineOffset ( qreal )
void setClip ( bool )
void setKeepMouseGrab ( bool keep )
void setParentItem ( QDeclarativeItem * parent )
void setSmooth ( bool smooth )
void setTransformOrigin ( TransformOrigin origin )
bool smooth () const
TransformOrigin transformOrigin () const

Signals

Q_REVISION ()
Q_REVISION ()

Protected Functions

virtual void geometryChanged ( const QRectF & newGeometry, const QRectF & oldGeometry )
bool heightValid () const
bool isComponentComplete () const
void setImplicitHeight ( qreal h )
void setImplicitWidth ( qreal w )
bool widthValid () const

Additional Inherited Members

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.

Member Type Documentation

enum QDeclarativeItem::TransformOrigin

Controls the point about which simple transforms like scale apply.

ConstantValueDescription
QDeclarativeItem::TopLeft0The top-left corner of the item.
QDeclarativeItem::Top1The center point of the top of the item.
QDeclarativeItem::TopRight2The top-right corner of the item.
QDeclarativeItem::Left3The left most point of the vertical middle.
QDeclarativeItem::Center4The center of the item.
QDeclarativeItem::Right5The right most point of the vertical middle.
QDeclarativeItem::BottomLeft6The bottom-left corner of the item.
QDeclarativeItem::Bottom7The center point of the bottom of the item.
QDeclarativeItem::BottomRight8The bottom-right corner of the item.

Property Documentation

baselineOffset : 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:

qreal baselineOffset () const
void setBaselineOffset ( qreal )

childrenRect : 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:

QRectF childrenRect ()

clip : 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:

bool clip () const
void setClip ( bool )

implicitHeight : const qreal

Access functions:

qreal implicitHeight () const

implicitWidth : const qreal

Access functions:

qreal implicitWidth () const

parent : QDeclarativeItem *

This property holds the parent of the item.

Access functions:

QDeclarativeItem * parentItem () const
void setParentItem ( QDeclarativeItem * parent )

Notifier signal:

void parentChanged ()

smooth : 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:

bool smooth () const
void setSmooth ( bool smooth )

Member Function Documentation

QDeclarativeItem::QDeclarativeItem ( QDeclarativeItem * parent = 0 )

Constructs a QDeclarativeItem with the given parent.

QDeclarativeItem::~QDeclarativeItem () [virtual]

Destroys the QDeclarativeItem.

QDeclarativeItem::Q_REVISION () [signal]

QDeclarativeItem::Q_REVISION () [signal]

QDeclarativeItem * QDeclarativeItem::childAt ( qreal x, qreal y ) const

Returns the visible child item at point (x, y), which is in this item's coordinate system, or 0 if there is no such item.

void QDeclarativeItem::forceActiveFocus ()

Forces active focus on the item.

This method sets focus on the item and makes sure that all the focus scopes higher in the object hierarchy are also given the focus.

void QDeclarativeItem::geometryChanged ( 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.

bool QDeclarativeItem::heightValid () const [protected]

Returns whether the height property has been set explicitly.

bool QDeclarativeItem::isComponentComplete () 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().

bool QDeclarativeItem::keepMouseGrab () const

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

See also setKeepMouseGrab().

QScriptValue QDeclarativeItem::mapFromItem ( const QScriptValue & item, qreal x, qreal y ) const

Maps the point (x, y), which is in item's coordinate system, to this item's coordinate system, and returns a script value with x and y properties matching the mapped cooordinate.

If item is a null value, this maps the point from the coordinate system of the root QML view.

See also Item::mapFromItem().

QScriptValue QDeclarativeItem::mapToItem ( const QScriptValue & item, qreal x, qreal y ) const

Maps the point (x, y), which is in this item's coordinate system, to item's coordinate system, and returns a script value with x and y properties matching the mapped cooordinate.

If item is a null value, this maps x and y to the coordinate system of the root QML view.

See also Item::mapToItem().

void QDeclarativeItem::setImplicitHeight ( 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().

void QDeclarativeItem::setImplicitWidth ( 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().

void QDeclarativeItem::setKeepMouseGrab ( 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().

void QDeclarativeItem::setTransformOrigin ( TransformOrigin origin )

Set the transform origin.

See also transformOrigin().

TransformOrigin QDeclarativeItem::transformOrigin () const

Returns the current transform origin.

See also setTransformOrigin().

bool QDeclarativeItem::widthValid () const [protected]

Returns whether the width property has been set explicitly.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.8
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web