\qmlclass Transform QQuickTransform
\inqmlmodule QtQuick 2
\ingroup qml-transform-elements
- \brief The Transform elements provide a way of building advanced transformations on Items.
+ \brief For specifying advanced transformations on Items
The Transform element is a base type which cannot be instantiated directly.
The following concrete Transform types are available:
\qmlclass Translate QQuickTranslate
\inqmlmodule QtQuick 2
\ingroup qml-transform-elements
- \brief The Translate object provides a way to move an Item without changing its x or y properties.
+ \brief Provides a way to move an Item without changing its x or y properties
The Translate object provides independent control over position in addition to the Item's x and y properties.
\qmlclass Scale QQuickScale
\inqmlmodule QtQuick 2
\ingroup qml-transform-elements
- \brief The Scale element provides a way to scale an Item.
+ \brief Provides a way to scale an Item
The Scale element gives more control over scaling than using \l Item's \l{Item::scale}{scale} property. Specifically,
it allows a different scale for the x and y axes, and allows the scale to be relative to an
\qmlclass Rotation QQuickRotation
\inqmlmodule QtQuick 2
\ingroup qml-transform-elements
- \brief The Rotation object provides a way to rotate an Item.
+ \brief Provides a way to rotate an Item
The Rotation object gives more control over rotation than using \l Item's \l{Item::rotation}{rotation} property.
Specifically, it allows (z axis) rotation to be relative to an arbitrary point.
\qmlclass KeyNavigation QQuickKeyNavigationAttached
\inqmlmodule QtQuick 2
\ingroup qml-basic-interaction-elements
- \brief The KeyNavigation attached property supports key navigation by arrow keys.
+ \brief Supports key navigation by arrow keys
Key-based user interfaces commonly allow the use of arrow keys to navigate between
focusable items. The KeyNavigation attached property enables this behavior by providing a
QQuickKeyNavigationAttached::QQuickKeyNavigationAttached(QObject *parent)
: QObject(*(new QQuickKeyNavigationAttachedPrivate), parent),
- QQuickItemKeyFilter(qobject_cast<QQuickItem*>(parent))
+ QQuickItemKeyFilter(qmlobject_cast<QQuickItem*>(parent))
{
m_processPost = true;
}
\qmlclass Keys QQuickKeysAttached
\inqmlmodule QtQuick 2
\ingroup qml-basic-interaction-elements
- \brief The Keys attached property provides key handling to Items.
+ \brief Provides key handling to Items
All visual primitives support key handling via the Keys
attached property. Keys can be handled via the onPressed
QQuickKeysAttached::QQuickKeysAttached(QObject *parent)
: QObject(*(new QQuickKeysAttachedPrivate), parent),
- QQuickItemKeyFilter(qobject_cast<QQuickItem*>(parent))
+ QQuickItemKeyFilter(qmlobject_cast<QQuickItem*>(parent))
{
Q_D(QQuickKeysAttached);
m_processPost = false;
- d->item = qobject_cast<QQuickItem*>(parent);
+ d->item = qmlobject_cast<QQuickItem*>(parent);
}
QQuickKeysAttached::~QQuickKeysAttached()
\qmlclass LayoutMirroring QQuickLayoutMirroringAttached
\inqmlmodule QtQuick 2
\ingroup qml-utility-elements
- \brief The LayoutMirroring attached property is used to mirror layout behavior.
+ \brief Property used to mirror layout behavior
The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors},
\l{Using QML Positioner and Repeater Items}{positioner} elements (such as \l Row and \l Grid)
if (isMirrorImplicit)
setLayoutMirror(inherit ? inheritedLayoutMirror : false);
for (int i = 0; i < childItems.count(); ++i) {
- if (QQuickItem *child = qobject_cast<QQuickItem *>(childItems.at(i))) {
+ if (QQuickItem *child = qmlobject_cast<QQuickItem *>(childItems.at(i))) {
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
}
/*!
\class QQuickItem
- \brief The QQuickItem class provides the most basic of all visual items in QML.
+ \brief Provides the most basic of all visual items in QML
\inmodule QtQuick
\inherits QtObject
\inqmlmodule QtQuick 2
\ingroup qml-basic-visual-elements
- \brief The Item is the most basic of all visual items in QML.
+ \brief A basic visual QML type
All visual items in Qt Quick inherit from Item. Although Item
has no visual appearance, it defines all the properties that are
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
- // This test is measurably (albeit only slightly) faster than qobject_cast<>()
- const QMetaObject *mo = o->metaObject();
- while (mo && mo != &QQuickItem::staticMetaObject) {
- mo = mo->d.superdata;
- }
-
- if (mo) {
- QQuickItem *item = static_cast<QQuickItem *>(o);
+ if (QQuickItem *item = qmlobject_cast<QQuickItem *>(o)) {
item->setParentItem(that);
} else {
if (o->inherits("QGraphicsItem"))
/*!
\property QQuickItem::childrenRect
- \brief The geometry of an item's children.
+ \brief Specifies the geometry of an item's children
This property holds the (collective) position and size of the item's children.
*/
/*!
\property QQuickItem::baselineOffset
- \brief The position of the item's baseline in local coordinates.
+ \brief Speciifies the position of the item's baseline in local coordinates
The baseline of a \l Text item is the imaginary line on which the text
sits. Controls containing text usually set their baseline to the
The main thread is blocked while this function is executed so it is safe to read
values from the QQuickItem instance and other objects in the main thread.
+ If no call to QQuickItem::updatePaintNode() result in actual scene graph
+ changes, like QSGNode::markDirty() or adding and removing nodes, then
+ the underlying implementation may decide to not render the scene again as
+ the visual outcome is identical.
+
\warning It is crucial that OpenGL operations and interaction with
the scene graph happens exclusively on the rendering thread,
primarily during the QQuickItem::updatePaintNode() call. The best
the QQuickItem::updatePaintNode() function.
\sa QSGMaterial, QSGSimpleMaterial, QSGGeometryNode, QSGGeometry,
- QSGFlatColorMaterial, QSGTextureMaterial
+ QSGFlatColorMaterial, QSGTextureMaterial, QSGNode::markDirty()
*/
QSGNode *QQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
emit baselineOffsetChanged(offset);
}
+
+/*!
+ * Schedules a call to updatePaintNode() for this item.
+ *
+ * The call to QQuickItem::updatePaintNode() will always happen if the
+ * item is showing in a QQuickCanvas.
+ *
+ * Only items which specifies QQuickItem::ItemHasContents are allowed
+ * to call QQuickItem::update().
+ */
void QQuickItem::update()
{
Q_D(QQuickItem);
}
}
+/*!
+ \qmlmethod object QtQuick2::Item::mapFromItem(Item item, real x, real y)
+ \qmlmethod object QtQuick2::Item::mapFromItem(Item item, real x, real y, real width, real height)
+
+ Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
+ item's coordinate system, to this item's coordinate system, and returns an object with \c x and
+ \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+
+ If \a item is a \c null value, this maps the point or rect from the coordinate system of
+ the root QML view.
+*/
void QQuickItem::mapFromItem(QQmlV8Function *args) const
{
if (args->Length() != 0) {
qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0;
qreal y = (args->Length() > 2)?(*args)[2]->NumberValue():0;
- QPointF p = mapFromItem(itemObj, QPointF(x, y));
+ if (args->Length() > 3) {
+ qreal w = (*args)[3]->NumberValue();
+ qreal h = (args->Length() > 4)?(*args)[4]->NumberValue():0;
+
+ QRectF r = mapRectFromItem(itemObj, QRectF(x, y, w, h));
+
+ rv->Set(v8::String::New("x"), v8::Number::New(r.x()));
+ rv->Set(v8::String::New("y"), v8::Number::New(r.y()));
+ rv->Set(v8::String::New("width"), v8::Number::New(r.width()));
+ rv->Set(v8::String::New("height"), v8::Number::New(r.height()));
+ } else {
+ QPointF p = mapFromItem(itemObj, QPointF(x, y));
- rv->Set(v8::String::New("x"), v8::Number::New(p.x()));
- rv->Set(v8::String::New("y"), v8::Number::New(p.y()));
+ rv->Set(v8::String::New("x"), v8::Number::New(p.x()));
+ rv->Set(v8::String::New("y"), v8::Number::New(p.y()));
+ }
}
}
return t;
}
+/*!
+ \qmlmethod object QtQuick2::Item::mapToItem(Item item, real x, real y)
+ \qmlmethod object QtQuick2::Item::mapToItem(Item item, real x, real y, real width, real height)
+
+ Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in this
+ item's coordinate system, to \a item's coordinate system, and returns an object with \c x and
+ \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+
+ If \a item is a \c null value, this maps the point or rect to the coordinate system of the
+ root QML view.
+*/
void QQuickItem::mapToItem(QQmlV8Function *args) const
{
if (args->Length() != 0) {
qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0;
qreal y = (args->Length() > 2)?(*args)[2]->NumberValue():0;
- QPointF p = mapToItem(itemObj, QPointF(x, y));
+ if (args->Length() > 3) {
+ qreal w = (*args)[3]->NumberValue();
+ qreal h = (args->Length() > 4)?(*args)[4]->NumberValue():0;
- rv->Set(v8::String::New("x"), v8::Number::New(p.x()));
- rv->Set(v8::String::New("y"), v8::Number::New(p.y()));
+ QRectF r = mapRectToItem(itemObj, QRectF(x, y, w, h));
+
+ rv->Set(v8::String::New("x"), v8::Number::New(r.x()));
+ rv->Set(v8::String::New("y"), v8::Number::New(r.y()));
+ rv->Set(v8::String::New("width"), v8::Number::New(r.width()));
+ rv->Set(v8::String::New("height"), v8::Number::New(r.height()));
+ } else {
+ QPointF p = mapToItem(itemObj, QPointF(x, y));
+
+ rv->Set(v8::String::New("x"), v8::Number::New(p.x()));
+ rv->Set(v8::String::New("y"), v8::Number::New(p.y()));
+ }
}
}
_stateGroup = new QQuickStateGroup;
if (!componentComplete)
_stateGroup->classBegin();
- FAST_CONNECT(_stateGroup, SIGNAL(stateChanged(QString)),
- q, SIGNAL(stateChanged(QString)))
+ qmlobject_connect(_stateGroup, QQuickStateGroup, SIGNAL(stateChanged(QString)),
+ q, QQuickItem, SIGNAL(stateChanged(QString)))
}
return _stateGroup;
return;
d->explicitVisible = v;
+ if (!v)
+ d->dirty(QQuickItemPrivate::Visible);
const bool childVisibilityChanged = d->setEffectiveVisibleRecur(d->calcEffectiveVisible());
if (childVisibilityChanged && d->parentItem)
/*!
\property QQuickItem::smooth
- \brief whether the item is smoothed or not.
+ \brief Specifies whether the item is smoothed or not
Primarily used in image based elements to decide if the item should use smooth
sampling or not. Smooth sampling is performed using linear interpolation, while
return QRectF(0, 0, d->width, d->height).contains(point);
}
-/*!
- \qmlmethod object QtQuick2::Item::mapFromItem(Item item, real x, real y)
-
- Maps the point (\a x, \a y), which is in \a item's coordinate system, to
- this item's coordinate system, and returns an object with \c x and \c y
- properties matching the mapped coordinate.
-
- If \a item is a \c null value, this maps the point from the coordinate
- system of the root QML view.
-*/
-/*!
- \qmlmethod object QtQuick2::Item::mapToItem(Item item, real x, real y)
-
- Maps the point (\a x, \a y), which is in this item's coordinate system, to
- \a item's coordinate system, and returns an object with \c x and \c y
- properties matching the mapped coordinate.
-
- If \a item is a \c null value, this maps \a x and \a y to the coordinate
- system of the root QML view.
-*/
QPointF QQuickItem::mapToItem(const QQuickItem *item, const QPointF &point) const
{
QPointF p = mapToScene(point);