
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQDeclarativeItem class provides the most basic of all visual items in QML.More...
| Header: | #include <QDeclarativeItem> |
| Since: | Qt 4.7 |
| Instantiated By: | Item |
| Inherits: | QGraphicsObject andQDeclarativeParserStatus |
| enum | TransformOrigin { TopLeft, Top, TopRight, Left, ..., BottomRight } |
|
|
| 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 |
| void | implicitHeightChanged() |
| void | implicitWidthChanged() |
| 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 |
TheQDeclarativeItem class provides the most basic of all visual items in QML.
All visual items in Qt Declarative inherit fromQDeclarativeItem. AlthoughQDeclarativeItem 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 subclassQDeclarativeItem to provide your own custom visual item that inherits these features. Note that, because it does not draw anything,QDeclarativeItem sets theQGraphicsItem::ItemHasNoContents flag. If you subclassQDeclarativeItem to create a visual item, you will need to unset this flag.
Controls the point about which simple transforms like scale apply.
| Constant | Value | Description |
|---|---|---|
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. |
This property holds the position of the item's baseline in local coordinates.
The baseline of aText 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) |
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() |
This property holds whether clipping is enabled. The default clip value isfalse.
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) |
Access functions:
| qreal | implicitHeight() const |
Notifier signal:
| void | implicitHeightChanged() |
Access functions:
| qreal | implicitWidth() const |
Notifier signal:
| void | implicitWidthChanged() |
This property holds the parent of the item.
Access functions:
| QDeclarativeItem * | parentItem() const |
| void | setParentItem(QDeclarativeItem * parent) |
Notifier signal:
| void | parentChanged() |
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) |
Constructs aQDeclarativeItem with the givenparent.
[virtual]QDeclarativeItem::~QDeclarativeItem()Destroys theQDeclarativeItem.
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.
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.
[virtual protected]void QDeclarativeItem::geometryChanged(constQRectF & newGeometry, constQRectF & oldGeometry)This function is called to handle this item's changes in geometry fromoldGeometry tonewGeometry. If the two geometries are the same, it doesn't do anything.
[protected]bool QDeclarativeItem::heightValid() constReturns whether the height property has been set explicitly.
[protected]bool QDeclarativeItem::isComponentComplete() constReturns 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 alsocomponentComplete().
Returns a value indicating whether mouse input should remain with this item exclusively.
See alsosetKeepMouseGrab().
Maps the point (x,y), which is initem's coordinate system, to this item's coordinate system, and returns a script value withx andy properties matching the mapped cooordinate.
Ifitem is anull value, this maps the point from the coordinate system of the root QML view.
See alsoItem::mapFromItem().
Maps the point (x,y), which is in this item's coordinate system, toitem's coordinate system, and returns a script value withx andy properties matching the mapped cooordinate.
Ifitem is anull value, this mapsx andy to the coordinate system of the root QML view.
See alsoItem::mapToItem().
[protected]void QDeclarativeItem::setImplicitHeight(qreal h)Sets the implied height of the item toh. This is the height implied by other properties that determine the content.
See alsoimplicitHeight().
[protected]void QDeclarativeItem::setImplicitWidth(qreal w)Sets the implied width of the item tow. This is the width implied by other properties that determine the content.
See alsoimplicitWidth().
The flag indicating whether the mouse should remain with this item is set tokeep.
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 setkeepMouseGrab to true once a threshold has been exceeded. OncekeepMouseGrab 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 alsokeepMouseGrab().
Set the transformorigin.
See alsotransformOrigin().
Returns the current transform origin.
See alsosetTransformOrigin().
[protected]bool QDeclarativeItem::widthValid() constReturns whether the width property has been set explicitly.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.