diff options
-rw-r--r-- | src/qml/jsruntime/qv4runtime_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qml.pri | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlaccessors.cpp | 105 | ||||
-rw-r--r-- | src/qml/qml/qqmlaccessors_p.h | 182 | ||||
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 22 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache_p.h | 5 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 34 | ||||
-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 |
12 files changed, 1 insertions, 357 deletions
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index 88c09ec5f9..a32b3f1663 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -60,8 +60,6 @@ QT_BEGIN_NAMESPACE -class QQmlAccessors; - #undef QV4_COUNT_RUNTIME_FUNCTIONS namespace QV4 { diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 4244b16210..8d8da3742d 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -20,7 +20,6 @@ SOURCES += \ $$PWD/qqmlinfo.cpp \ $$PWD/qqmlerror.cpp \ $$PWD/qqmlvaluetype.cpp \ - $$PWD/qqmlaccessors.cpp \ $$PWD/qqmlxmlhttprequest.cpp \ $$PWD/qqmlcleanup.cpp \ $$PWD/qqmlpropertycache.cpp \ @@ -87,7 +86,6 @@ HEADERS += \ $$PWD/qqmldata_p.h \ $$PWD/qqmlerror.h \ $$PWD/qqmlvaluetype_p.h \ - $$PWD/qqmlaccessors_p.h \ $$PWD/qqmlxmlhttprequest_p.h \ $$PWD/qqmlcleanup_p.h \ $$PWD/qqmlpropertycache_p.h \ diff --git a/src/qml/qml/qqmlaccessors.cpp b/src/qml/qml/qqmlaccessors.cpp deleted file mode 100644 index 7b0fafdc90..0000000000 --- a/src/qml/qml/qqmlaccessors.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qqmlaccessors_p.h" - -#include "qqmldata_p.h" -#include "qqmlnotifier_p.h" - -QT_BEGIN_NAMESPACE - -struct AccessorProperties { - AccessorProperties(); - - QReadWriteLock lock; - QHash<const QMetaObject *, QQmlAccessorProperties::Properties> properties; -}; - -Q_GLOBAL_STATIC(AccessorProperties, accessorProperties) - -static void buildNameMask(QQmlAccessorProperties::Properties &properties) -{ - quint32 mask = 0; - - for (int ii = 0; ii < properties.count; ++ii) { - Q_ASSERT(strlen(properties.properties[ii].name) == properties.properties[ii].nameLength); - Q_ASSERT(properties.properties[ii].nameLength > 0); - - mask |= (1 << qMin(31U, properties.properties[ii].nameLength - 1)); - } - - properties.nameMask = mask; -} - -AccessorProperties::AccessorProperties() -{ -} - -QQmlAccessorProperties::Properties::Properties(Property *properties, int count) -: count(count), properties(properties) -{ - buildNameMask(*this); -} - -QQmlAccessorProperties::Properties -QQmlAccessorProperties::properties(const QMetaObject *mo) -{ - AccessorProperties *This = accessorProperties(); - - QReadLocker lock(&This->lock); - return This->properties.value(mo); -} - -void QQmlAccessorProperties::registerProperties(const QMetaObject *mo, int count, - Property *props) -{ - Q_ASSERT(count > 0); - - Properties properties(props, count); - - AccessorProperties *This = accessorProperties(); - - QWriteLocker lock(&This->lock); - - Q_ASSERT(!This->properties.contains(mo) || This->properties.value(mo) == properties); - - This->properties.insert(mo, properties); -} - -QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h deleted file mode 100644 index e98663adfe..0000000000 --- a/src/qml/qml/qqmlaccessors_p.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLACCESSORS_P_H -#define QQMLACCESSORS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qtqmlglobal_p.h> -#include <QtCore/qbytearray.h> -#include <QtCore/qvector.h> -#include <QtCore/qhash.h> -#include <QtCore/QReadWriteLock> - -#if defined(Q_OS_QNX) || defined(Q_OS_LINUX) -#include <stdint.h> -#endif - -QT_BEGIN_NAMESPACE - -class QObject; -struct QMetaObject; -class QQmlNotifier; - -// QML "accessor properties" allow V4 and V8 to bypass Qt's meta system to read and, more -// importantly, subscribe to properties directly. Any property that is primarily read -// from bindings is a candidate for inclusion as an accessor property. -// -// To define accessor properties, use the QML_DECLARE_PROPERTIES() and QML_DEFINE_PROPERTIES() -// macros. The QML_DECLARE_PROPERTIES() macro is used to specify the properties, and the -// QML_DEFINE_PROPERTIES() macro to register the properties with the -// QQmlAccessorProperties singleton. -// -// A class with accessor properties must also add the Q_CLASSINFO("qt_HasQmlAccessors", "true") -// tag to its declaration. This is essential for QML to maintain internal consistency, -// and forgetting to do so will probably cause your application to qFatal() with a -// helpful reminder of this requirement. -// -// It is important that QML_DEFINE_PROPERTIES() has been called before QML ever sees -// the type with the accessor properties. As QML_DEFINE_PROPERTIES() is idempotent, it is -// recommended to call it in the type's constructor as well as when the type is registered -// as a QML element (if it ever is). QML_DEFINE_PROPERTIES() is a very cheap operation -// if registration has already occurred. - -#define QML_DECLARE_PROPERTIES(type) \ - static volatile bool qqml_accessor_properties_isregistered_ ## type = false; \ - static QQmlAccessorProperties::Property qqml_accessor_properties_ ## type[] = - -#define QML_DEFINE_PROPERTIES(type) \ - do { \ - if (!qqml_accessor_properties_isregistered_ ## type) { \ - int count = sizeof(qqml_accessor_properties_ ## type) / \ - sizeof(QQmlAccessorProperties::Property); \ - QQmlAccessorProperties::registerProperties(&type::staticMetaObject, count, \ - qqml_accessor_properties_ ## type);\ - qqml_accessor_properties_isregistered_ ## type = true; \ - } \ - } while (false); - -#define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable, setter) \ - static void clazz ## _ ## name ## Read(QObject *o, void *rv) \ - { \ - clazz ## Private *d = clazz ## Private::get(static_cast<clazz *>(o)); \ - *static_cast<cpptype *>(rv) = d->variable; \ - } \ - static void clazz ## _ ## name ## Write(QObject *o, void *rv) \ - { \ - static_cast<clazz *>(o)->setter(*static_cast<cpptype *>(rv)); \ - } - -#define QML_PROPERTY_NAME(name) #name, sizeof #name - 1 - -class QQmlAccessors -{ -public: - void (*read)(QObject *object, void *output); - void (*write)(QObject *object, void *output); - void (*notifier)(QObject *object, QQmlNotifier **notifier); -}; - -namespace QQmlAccessorProperties { - struct Property { - const char *name; - unsigned int nameLength; - qintptr data; - QQmlAccessors *accessors; - }; - - struct Properties { - inline Properties(); - Properties(Property *, int); - - bool operator==(const Properties &o) const { - return count == o.count && properties == o.properties; - } - - inline Property *property(const char *name); - - int count; - Property *properties; - quint32 nameMask; - }; - - Properties properties(const QMetaObject *); - void Q_QML_PRIVATE_EXPORT registerProperties(const QMetaObject *, int, Property *); -}; - -QQmlAccessorProperties::Property * -QQmlAccessorProperties::Properties::property(const char *name) -{ - if (count == 0) - return 0; - - const unsigned int length = (unsigned int)strlen(name); - - Q_ASSERT(length); - - if (nameMask & (1 << qMin(31U, length - 1))) { - - for (int ii = 0; ii < count; ++ii) { - if (properties[ii].nameLength == length && 0 == qstrcmp(name, properties[ii].name)) - return &properties[ii]; - } - - } - - return 0; -} - -QQmlAccessorProperties::Properties::Properties() -: count(0), properties(0), nameMask(0) -{ -} - -QT_END_NAMESPACE - -#endif // QQMLACCESSORS_P_H diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index d944857fc1..896bc8d51d 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -43,7 +43,6 @@ #include "qqmlcontext.h" #include "qqmlinfo.h" #include "qqmldata_p.h" -#include "qqmlaccessors_p.h" #include <private/qqmlprofiler_p.h> #include <private/qqmlexpression_p.h> #include <private/qqmlscriptstring_p.h> diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index e02d362815..2218f277d6 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -54,7 +54,6 @@ #include <private/qqmlscriptstring_p.h> #include <private/qqmlpropertyvalueinterceptor_p.h> #include <private/qqmlvaluetypeproxybinding_p.h> -#include <private/qqmlaccessors_p.h> QT_USE_NAMESPACE diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index ed00eddb30..b9e2213035 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -45,7 +45,6 @@ #include <private/qv8engine_p.h> #include <private/qmetaobject_p.h> -#include <private/qqmlaccessors_p.h> #include <private/qmetaobjectbuilder_p.h> #include <private/qv4value_p.h> @@ -500,35 +499,16 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, int signalCount = metaObjectSignalCount(metaObject); int classInfoCount = QMetaObjectPrivate::get(metaObject)->classInfoCount; - QQmlAccessorProperties::Properties accessorProperties; - if (classInfoCount) { int classInfoOffset = metaObject->classInfoOffset(); - bool hasFastProperty = false; for (int ii = 0; ii < classInfoCount; ++ii) { int idx = ii + classInfoOffset; QMetaClassInfo mci = metaObject->classInfo(idx); const char *name = mci.name(); - if (0 == qstrcmp(name, "qt_HasQmlAccessors")) { - hasFastProperty = true; - } else if (0 == qstrcmp(name, "DefaultProperty")) { + if (0 == qstrcmp(name, "DefaultProperty")) { _defaultPropertyName = QString::fromUtf8(mci.value()); } } - - if (hasFastProperty) { - accessorProperties = QQmlAccessorProperties::properties(metaObject); - if (accessorProperties.count == 0) - qFatal("QQmlPropertyCache: %s has FastProperty class info, but has not " - "installed property accessors", metaObject->className()); - } else { -#ifndef QT_NO_DEBUG - accessorProperties = QQmlAccessorProperties::properties(metaObject); - if (accessorProperties.count != 0) - qFatal("QQmlPropertyCache: %s has fast property accessors, but is missing " - "FastProperty class info", metaObject->className()); -#endif - } } //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index f28b2d0599..4da02037fa 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -62,7 +62,6 @@ #include <QtCore/qvector.h> #include <private/qv4value_p.h> -#include <private/qqmlaccessors_p.h> #include <limits> @@ -73,7 +72,6 @@ class QMetaProperty; class QQmlEngine; class QJSEngine; class QQmlPropertyData; -class QQmlAccessors; class QMetaObjectBuilder; class QQmlPropertyCacheMethodArguments; class QQmlVMEMetaObject; @@ -159,7 +157,6 @@ public: bool isFinal() const { return _flags.isFinal; } bool isOverridden() const { return _flags.isOverridden; } bool isDirect() const { return _flags.isDirect; } - bool hasAccessors() const { return accessors() != nullptr; } bool hasStaticMetaCallFunction() const { return staticMetaCallFunction() != nullptr; } bool isFunction() const { return _flags.type == Flags::FunctionType; } bool isQObject() const { return _flags.type == Flags::QObjectDerivedType; } @@ -240,8 +237,6 @@ public: _metaObjectOffset = qint16(off); } - QQmlAccessors *accessors() const { return nullptr; } // TODO: remove in subsequent patch - StaticMetaCallFunction staticMetaCallFunction() const { return _staticMetaCallFunction; } void trySetStaticMetaCallFunction(StaticMetaCallFunction f, unsigned relativePropertyIndex) { diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4c6b0b4167..d38edfb7ab 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 @@ -3165,8 +3133,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 9ea2712e18..6d79d71021 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")); |