diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-21 09:24:03 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-21 09:24:03 +0200 |
commit | cb5cbe9eb7c9a68acbe19ff2fd0c299e30f42eca (patch) | |
tree | 2ba783322c213c9c533163dc69c950367f767a44 /src/quick/items | |
parent | 8de7ec4bf82c35ff1413fb5f5a5ca1788dc93af3 (diff) | |
parent | 16914894f035963ace51c92de13aad11a53c3cf8 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/qml/compiler/qv4isel_moth_p.h
Change-Id: I8e86a649d1ef8ad27dc66cc8c290093b2faabc69
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 47 | ||||
-rw-r--r-- | src/quick/items/qquickitem.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquickitem_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 1 |
4 files changed, 10 insertions, 41 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 8771e1a56e..72edb5aeb8 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -66,7 +66,6 @@ #include <private/qqmlopenmetaobject_p.h> #include <QtQuick/private/qquickstate_p.h> #include <private/qquickitem_p.h> -#include <private/qqmlaccessors_p.h> #include <QtQuick/private/qquickaccessibleattached_p.h> #include <private/qv4engine_p.h> @@ -108,37 +107,6 @@ void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1) } } -static void QQuickItem_parentNotifier(QObject *o, QQmlNotifier **n) -{ - QQuickItemPrivate *d = QQuickItemPrivate::get(static_cast<QQuickItem *>(o)); - *n = &d->parentNotifier; -} - -QML_PRIVATE_ACCESSOR(QQuickItem, QQuickItem *, parent, parentItem, setParentItem) -QML_PRIVATE_ACCESSOR(QQuickItem, qreal, x, x, setX) -QML_PRIVATE_ACCESSOR(QQuickItem, qreal, y, y, setY) -QML_PRIVATE_ACCESSOR(QQuickItem, qreal, width, width, setWidth) -QML_PRIVATE_ACCESSOR(QQuickItem, qreal, height, height, setHeight) - -static QQmlAccessors QQuickItem_parent = { QQuickItem_parentRead, QQuickItem_parentWrite, QQuickItem_parentNotifier }; -static QQmlAccessors QQuickItem_x = { QQuickItem_xRead, QQuickItem_xWrite, 0 }; -static QQmlAccessors QQuickItem_y = { QQuickItem_yRead, QQuickItem_yWrite, 0 }; -static QQmlAccessors QQuickItem_width = { QQuickItem_widthRead, QQuickItem_widthWrite, 0 }; -static QQmlAccessors QQuickItem_height = { QQuickItem_heightRead, QQuickItem_heightWrite, 0 }; - -QML_DECLARE_PROPERTIES(QQuickItem) { - { QML_PROPERTY_NAME(parent), 0, &QQuickItem_parent }, - { QML_PROPERTY_NAME(x), 0, &QQuickItem_x }, - { QML_PROPERTY_NAME(y), 0, &QQuickItem_y }, - { QML_PROPERTY_NAME(width), 0, &QQuickItem_width }, - { QML_PROPERTY_NAME(height), 0, &QQuickItem_height } -}; - -void QQuickItemPrivate::registerAccessorProperties() -{ - QML_DEFINE_PROPERTIES(QQuickItem); -} - /*! \qmltype Transform \instantiates QQuickTransform @@ -1482,6 +1450,9 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) behavior to all child items as well. If the \c LayoutMirroring attached property has not been defined for an item, mirroring is not enabled. + \note Since Qt 5.8, \c LayoutMirroring can be attached to a \l Window. In practice, it is the same as + attaching \c LayoutMirroring to the window's \c contentItem. + The following example shows mirroring in action. The \l Row below is specified as being anchored to the left of its parent. However, since mirroring has been enabled, the anchor is horizontally reversed and it is now anchored to the right. Also, since items in a \l Row are positioned @@ -1531,11 +1502,15 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) QQuickLayoutMirroringAttached::QQuickLayoutMirroringAttached(QObject *parent) : QObject(parent), itemPrivate(0) { - if (QQuickItem *item = qobject_cast<QQuickItem*>(parent)) { + if (QQuickItem *item = qobject_cast<QQuickItem *>(parent)) itemPrivate = QQuickItemPrivate::get(item); + else if (QQuickWindow *window = qobject_cast<QQuickWindow *>(parent)) + itemPrivate = QQuickItemPrivate::get(window->contentItem()); + + if (itemPrivate) itemPrivate->extra.value().layoutDirectionAttached = this; - } else - qmlInfo(parent) << tr("LayoutDirection attached property only works with Items"); + else + qmlInfo(parent) << tr("LayoutDirection attached property only works with Items and Windows"); } QQuickLayoutMirroringAttached * QQuickLayoutMirroringAttached::qmlAttachedProperties(QObject *object) @@ -3165,8 +3140,6 @@ void QQuickItemPrivate::init(QQuickItem *parent) { Q_Q(QQuickItem); - registerAccessorProperties(); - baselineOffset = 0.0; if (parent) { diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 0352f5ace8..87ae83246c 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -148,7 +148,6 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickItemLayer *layer READ layer DESIGNABLE false CONSTANT FINAL) Q_CLASSINFO("DefaultProperty", "data") - Q_CLASSINFO("qt_HasQmlAccessors", "true") public: enum Flag { diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 9e4c7bc0e8..7a39b7c4c7 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -244,8 +244,6 @@ public: static QQuickItemPrivate* get(QQuickItem *item) { return item->d_func(); } static const QQuickItemPrivate* get(const QQuickItem *item) { return item->d_func(); } - static void registerAccessorProperties(); - QQuickItemPrivate(); ~QQuickItemPrivate(); void init(QQuickItem *parent); diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index fb60331ce2..1bc1aebe4f 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -133,7 +133,6 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) { QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent }; QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); - QQuickItemPrivate::registerAccessorProperties(); #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie")); |