1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquickdesignercustomparserobject_p.h"
5#include "qquickdesignersupportmetainfo_p.h"
6#include "qqmldesignermetaobject_p.h"
7
8#include <private/qqmlmetatype_p.h>
9
10QT_BEGIN_NAMESPACE
11
12bool QQuickDesignerSupportMetaInfo::isSubclassOf(QObject *object, const QByteArray &superTypeName)
13{
14 if (object == nullptr)
15 return false;
16
17 const QMetaObject *metaObject = object->metaObject();
18
19 while (metaObject) {
20 QQmlType qmlType = QQmlMetaType::qmlType(metaObject);
21 if (qmlType.qmlTypeName() == QLatin1String(superTypeName)) // ignore version numbers
22 return true;
23
24 if (metaObject->className() == superTypeName)
25 return true;
26
27 metaObject = metaObject->superClass();
28 }
29
30 return false;
31}
32
33void QQuickDesignerSupportMetaInfo::registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const QQuickDesignerSupport::PropertyName &))
34{
35 QQmlDesignerMetaObject::registerNotifyPropertyChangeCallBack(callback);
36}
37
38void QQuickDesignerSupportMetaInfo::registerMockupObject(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
39{
40 qmlRegisterCustomType<QQuickDesignerCustomParserObject>(uri, versionMajor, versionMinor, qmlName, parser: new QQuickDesignerCustomParser);
41}
42
43QT_END_NAMESPACE
44
45

source code of qtdeclarative/src/quick/designer/qquickdesignersupportmetainfo.cpp