Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlmetaobject.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 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 "qqmlmetaobject_p.h"
5
6#include <private/qqmlengine_p.h>
7#include <private/qqmlpropertycachemethodarguments_p.h>
8
10
12{
13 int offset;
14
15 switch (type) {
19 offset = (*metaObject)->propertyOffset();
20 while (*index < offset) {
21 *metaObject = (*metaObject)->superClass();
22 offset = (*metaObject)->propertyOffset();
23 }
24 break;
26 offset = (*metaObject)->methodOffset();
27 while (*index < offset) {
28 *metaObject = (*metaObject)->superClass();
29 offset = (*metaObject)->methodOffset();
30 }
31 break;
32 default:
33 offset = 0;
35 offset = INT_MAX;
36 }
37
38 *index -= offset;
39}
40
42{
43 Q_ASSERT(_m && data.coreIndex() >= 0);
44
45 QMetaType type = data.propType();
46 if (!type.isValid()) {
47 // Find the return type name from the method info
48 type = _m->method(data.coreIndex()).returnMetaType();
49 }
50 if (type.flags().testFlag(QMetaType::IsEnumeration))
52 if (type.isValid())
53 return type;
54 else if (unknownTypeError)
55 *unknownTypeError = _m->method(data.coreIndex()).typeName();
56 return QMetaType();
57}
58
\inmodule QtCore
Definition qbytearray.h:57
const char * typeName() const
Returns the return type name of this method.
QMetaType returnMetaType() const
\inmodule QtCore
Definition qmetatype.h:341
QMetaType underlyingType() const
@ IsEnumeration
Definition qmetatype.h:407
QMetaType methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const
const QMetaObject * metaObject() const
static void resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type, const QMetaObject **metaObject, int *index)
const QMetaObject * _m
Combined button and popup list for selecting options.
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type
GLenum GLuint GLintptr offset
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_UNIMPLEMENTED()
obj metaObject() -> className()
\inmodule QtCore
int methodOffset() const
Returns the method offset for this class; i.e.
const QMetaObject * superClass() const
Returns the meta-object of the superclass, or \nullptr if there is no such object.
QMetaMethod method(int index) const
Returns the meta-data for the method with the given index.
int propertyOffset() const
Returns the property offset for this class; i.e.