diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-04-07 16:57:58 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-26 17:58:01 +0100 |
commit | e6b45a2f5dad8105a8f493e2167988a95c1f08ed (patch) | |
tree | 4d7710185cd8e1726c05718d8d3f7341145610db | |
parent | 9b337179e1b2c8ece6401262d0f6f2a47e471382 (diff) |
Get rid of the QQmlStaticMetaObject
This can easily be folded into it's parent classes.
Task-number: QTBUG-82931
Change-Id: I92e490b35c29aacdff3557d0b6318b1dd43e7bbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | src/qml/.prev_CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/qml/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 9 | ||||
-rw-r--r-- | src/qml/qml/qml.pri | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetaobject.cpp | 7 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetaobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectorgadget_p.h | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlstaticmetaobject.cpp | 51 | ||||
-rw-r--r-- | src/qml/qml/qqmlstaticmetaobject_p.h | 68 |
9 files changed, 16 insertions, 133 deletions
diff --git a/src/qml/.prev_CMakeLists.txt b/src/qml/.prev_CMakeLists.txt index 676e8727e3..6415b4cf6b 100644 --- a/src/qml/.prev_CMakeLists.txt +++ b/src/qml/.prev_CMakeLists.txt @@ -282,7 +282,6 @@ qt_internal_add_module(Qml qml/qqmlscriptdata.cpp qml/qqmlscriptdata_p.h qml/qqmlscriptstring.cpp qml/qqmlscriptstring.h qml/qqmlscriptstring_p.h qml/qqmlsourcecoordinate_p.h - qml/qqmlstaticmetaobject.cpp qml/qqmlstaticmetaobject_p.h qml/qqmlstringconverters.cpp qml/qqmlstringconverters_p.h qml/qqmltype.cpp qml/qqmltype_p.h qml/qqmltype_p_p.h diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 8e977687cc..223ab4004e 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -283,7 +283,6 @@ qt_internal_add_module(Qml qml/qqmlscriptdata.cpp qml/qqmlscriptdata_p.h qml/qqmlscriptstring.cpp qml/qqmlscriptstring.h qml/qqmlscriptstring_p.h qml/qqmlsourcecoordinate_p.h - qml/qqmlstaticmetaobject.cpp qml/qqmlstaticmetaobject_p.h qml/qqmlstringconverters.cpp qml/qqmlstringconverters_p.h qml/qqmltype.cpp qml/qqmltype_p.h qml/qqmltype_p_p.h diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 7f2da462b5..a4f676ef66 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -39,7 +39,7 @@ #include "qv4qobjectwrapper_p.h" -#include <private/qqmlstaticmetaobject_p.h> +#include <private/qqmlobjectorgadget_p.h> #include <private/qqmlengine_p.h> #include <private/qqmlvmemetaobject_p.h> #include <private/qqmlbinding_p.h> @@ -1599,8 +1599,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ QQmlMetaObject::ArgTypeStorage storage; if (data.isConstructor()) - args = static_cast<const QQmlStaticMetaObject&>(object).constructorParameterTypes( - data.coreIndex(), &storage, &unknownTypeError); + args = object.constructorParameterTypes(data.coreIndex(), &storage, &unknownTypeError); else args = object.methodParameterTypes(data.coreIndex(), &storage, &unknownTypeError); @@ -2292,7 +2291,7 @@ ReturnedValue QMetaObjectWrapper::constructInternal(const Value *argv, int argc) ReturnedValue QMetaObjectWrapper::callConstructor(const QQmlPropertyData &data, QV4::ExecutionEngine *engine, QV4::CallData *callArgs) const { const QMetaObject* mo = d()->metaObject; - const QQmlStaticMetaObject object(mo); + const QQmlObjectOrGadget object(mo); return CallPrecise(object, data, engine, callArgs, QMetaObject::CreateInstance); } @@ -2300,7 +2299,7 @@ ReturnedValue QMetaObjectWrapper::callConstructor(const QQmlPropertyData &data, ReturnedValue QMetaObjectWrapper::callOverloadedConstructor(QV4::ExecutionEngine *engine, QV4::CallData *callArgs) const { const int numberOfConstructors = d()->constructorCount; const int argumentCount = callArgs->argc(); - const QQmlStaticMetaObject object(d()->metaObject); + const QQmlObjectOrGadget object(d()->metaObject); QQmlPropertyData best; int bestParameterScore = INT_MAX; diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 3601f78d28..fa0783b237 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -39,7 +39,6 @@ SOURCES += \ $$PWD/qqmlmetaobject.cpp \ $$PWD/qqmlnotifier.cpp \ $$PWD/qqmlobjectorgadget.cpp \ - $$PWD/qqmlstaticmetaobject.cpp \ $$PWD/qqmltypenotavailable.cpp \ $$PWD/qqmltypenamecache.cpp \ $$PWD/qqmlscriptstring.cpp \ @@ -130,7 +129,6 @@ HEADERS += \ $$PWD/qqmlmetaobject_p.h \ $$PWD/qqmlnotifier_p.h \ $$PWD/qqmlobjectorgadget_p.h \ - $$PWD/qqmlstaticmetaobject_p.h \ $$PWD/qqmltypenotavailable_p.h \ $$PWD/qqmltypenamecache_p.h \ $$PWD/qqmlscriptstring.h \ diff --git a/src/qml/qml/qqmlmetaobject.cpp b/src/qml/qml/qqmlmetaobject.cpp index da587de10e..84a906b4f9 100644 --- a/src/qml/qml/qqmlmetaobject.cpp +++ b/src/qml/qml/qqmlmetaobject.cpp @@ -176,6 +176,13 @@ int *QQmlMetaObject::methodParameterTypes(int index, ArgTypeStorage *argStorage, return methodParameterTypes(m, argStorage, unknownTypeError); } +int *QQmlMetaObject::constructorParameterTypes(int index, ArgTypeStorage *dummy, + QByteArray *unknownTypeError) const +{ + QMetaMethod m = _m->constructor(index); + return methodParameterTypes(m, dummy, unknownTypeError); +} + int *QQmlMetaObject::methodParameterTypes(const QMetaMethod &m, ArgTypeStorage *argStorage, QByteArray *unknownTypeError) const { diff --git a/src/qml/qml/qqmlmetaobject_p.h b/src/qml/qml/qqmlmetaobject_p.h index d2b034dca2..9465458780 100644 --- a/src/qml/qml/qqmlmetaobject_p.h +++ b/src/qml/qml/qqmlmetaobject_p.h @@ -92,6 +92,8 @@ public: int methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const; int *methodParameterTypes(int index, ArgTypeStorage *argStorage, QByteArray *unknownTypeError) const; + int *constructorParameterTypes(int index, ArgTypeStorage *dummy, QByteArray *unknownTypeError) const; + static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to); diff --git a/src/qml/qml/qqmlobjectorgadget_p.h b/src/qml/qml/qqmlobjectorgadget_p.h index c5f5f58a3a..e8372ecd9b 100644 --- a/src/qml/qml/qqmlobjectorgadget_p.h +++ b/src/qml/qml/qqmlobjectorgadget_p.h @@ -66,16 +66,14 @@ public: : QQmlMetaObject(propertyCache) , ptr(gadget) {} + QQmlObjectOrGadget(const QMetaObject* metaObject) + : QQmlMetaObject(metaObject) + {} void metacall(QMetaObject::Call type, int index, void **argv) const; private: QBiPointer<QObject, void> ptr; - -protected: - QQmlObjectOrGadget(const QMetaObject* metaObject) - : QQmlMetaObject(metaObject) - {} }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlstaticmetaobject.cpp b/src/qml/qml/qqmlstaticmetaobject.cpp deleted file mode 100644 index 57438452d2..0000000000 --- a/src/qml/qml/qqmlstaticmetaobject.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 "qqmlstaticmetaobject_p.h" - -QT_BEGIN_NAMESPACE - -int *QQmlStaticMetaObject::constructorParameterTypes(int index, ArgTypeStorage *dummy, - QByteArray *unknownTypeError) const -{ - QMetaMethod m = _m->constructor(index); - return methodParameterTypes(m, dummy, unknownTypeError); -} - -QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlstaticmetaobject_p.h b/src/qml/qml/qqmlstaticmetaobject_p.h deleted file mode 100644 index e1ca496080..0000000000 --- a/src/qml/qml/qqmlstaticmetaobject_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 QQMLSTATICMETAOBJECT_P_H -#define QQMLSTATICMETAOBJECT_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/qqmlobjectorgadget_p.h> - -QT_BEGIN_NAMESPACE - -class QQmlStaticMetaObject : public QQmlObjectOrGadget { -public: - QQmlStaticMetaObject(const QMetaObject* metaObject) - : QQmlObjectOrGadget(metaObject) - {} - int *constructorParameterTypes(int index, ArgTypeStorage *dummy, QByteArray *unknownTypeError) const; -}; - -QT_END_NAMESPACE - -#endif // QQMLSTATICMETAOBJECT_P_H |