Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmlglobal.cpp File Reference
#include <QtQml/private/qjsvalue_p.h>
#include <QtQml/private/qqmlglobal_p.h>
#include <QtQml/private/qqmlmetatype_p.h>
#include <QtQml/qqmlengine.h>
#include <QtCore/private/qvariant_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
#include "moc_qqmlglobal_p.cpp"
+ Include dependency graph for qqmlglobal.cpp:

Go to the source code of this file.

Functions

static QT_BEGIN_NAMESPACE bool isConstructibleMetaType (const QMetaType metaType)
 
static voidcreateVariantData (QMetaType type, QVariant *variant)
 
static void callConstructor (const QMetaObject *targetMetaObject, int i, void *source, void *target)
 
template<typename Allocate >
static void fromVerifiedType (const QMetaObject *targetMetaObject, int ctorIndex, void *source, Allocate &&allocate)
 
template<typename Allocate , typename Retrieve >
static bool fromMatchingType (const QMetaObject *targetMetaObject, Allocate &&allocate, Retrieve &&retrieve)
 
template<typename Allocate >
static bool fromMatchingType (const QMetaObject *targetMetaObject, const QV4::Value &source, Allocate &&allocate)
 
template<typename Allocate >
static bool fromMatchingType (const QMetaObject *targetMetaObject, QVariant source, Allocate &&allocate)
 
template<typename Allocate >
static bool fromString (const QMetaObject *mo, QString s, Allocate &&allocate)
 
template<typename Get , typename Convert >
static bool doWriteProperty (const QMetaProperty &metaProperty, void *target, Get &&get, Convert &&convert)
 
static void doWriteProperties (const QMetaObject *targetMetaObject, void *target, const QV4::Value &source)
 
static QVariant byProperties (const QMetaObject *targetMetaObject, QMetaType metaType, const QV4::Value &source)
 
template<typename Read >
static void doWriteProperties (const QMetaObject *targetMetaObject, void *target, const QMetaObject *sourceMetaObject, Read &&read)
 
static void doWriteProperties (const QMetaObject *targetMeta, void *target, QObject *source)
 
static QVariant byProperties (const QMetaObject *targetMetaObject, QMetaType targetMetaType, QObject *source)
 
static QVariant byProperties (const QMetaObject *targetMetaObject, QMetaType targetMetaType, const QMetaObject *sourceMetaObject, const void *source)
 
template<typename Map >
void doWriteProperties (const QMetaObject *targetMetaObject, void *target, const Map &source)
 
template<typename Map >
QVariant byProperties (const QMetaObject *targetMetaObject, QMetaType targetMetaType, const Map &source)
 
static QVariant byProperties (const QMetaObject *targetMetaObject, QMetaType targetMetaType, const QVariant &source)
 
template<typename Allocate , typename DefaultConstruct >
bool createOrConstructValueType (const QQmlType &targetType, const QV4::Value &source, Allocate &&allocate, DefaultConstruct &&defaultConstruct)
 
template<typename Allocate , typename DefaultConstruct >
bool createOrConstructValueType (const QQmlType &targetType, QMetaType sourceMetaType, void *source, Allocate &&allocate, DefaultConstruct &&defaultConstruct)
 
static QVariant fromJSValue (const QQmlType &type, const QJSValue &s, QMetaType metaType)
 
Q_QML_PRIVATE_EXPORT QQmlColorProviderQQml_setColorProvider (QQmlColorProvider *newProvider)
 
static QQmlColorProvider ** getColorProvider (void)
 
Q_AUTOTEST_EXPORT QQmlColorProviderQQml_colorProvider (void)
 
Q_QML_PRIVATE_EXPORT QQmlGuiProviderQQml_setGuiProvider (QQmlGuiProvider *newProvider)
 
static QQmlGuiProvider ** getGuiProvider (void)
 
Q_AUTOTEST_EXPORT QQmlGuiProviderQQml_guiProvider (void)
 
static const QQmlDataddata_for_cast (QObject *object)
 
bool qmlobject_can_cpp_cast (QObject *object, const QMetaObject *mo)
 
bool qmlobject_can_qml_cast (QObject *object, const QQmlType &type)
 

Variables

static QQmlColorProvidercolorProvider = nullptr
 
static QQmlGuiProviderguiProvider = nullptr
 

Function Documentation

◆ byProperties() [1/5]

static QVariant byProperties ( const QMetaObject targetMetaObject,
QMetaType  metaType,
const QV4::Value source 
)
static

Definition at line 272 of file qqmlglobal.cpp.

References doWriteProperties().

Referenced by byProperties(), QQmlValueTypeProvider::createValueType(), and QQmlValueTypeProvider::createValueType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ byProperties() [2/5]

template<typename Map >
QVariant byProperties ( const QMetaObject targetMetaObject,
QMetaType  targetMetaType,
const Map source 
)

Definition at line 402 of file qqmlglobal.cpp.

References doWriteProperties().

+ Here is the call graph for this function:

◆ byProperties() [3/5]

static QVariant byProperties ( const QMetaObject targetMetaObject,
QMetaType  targetMetaType,
const QMetaObject sourceMetaObject,
const void source 
)
static

Definition at line 346 of file qqmlglobal.cpp.

References doWriteProperties().

+ Here is the call graph for this function:

◆ byProperties() [4/5]

static QVariant byProperties ( const QMetaObject targetMetaObject,
QMetaType  targetMetaType,
const QVariant source 
)
static

Definition at line 410 of file qqmlglobal.cpp.

References QJSValuePrivate::asReturnedValue(), byProperties(), QQmlMetaType::metaObjectForValueType(), and QMetaType::PointerToQObject.

+ Here is the call graph for this function:

◆ byProperties() [5/5]

static QVariant byProperties ( const QMetaObject targetMetaObject,
QMetaType  targetMetaType,
QObject source 
)
static

Definition at line 335 of file qqmlglobal.cpp.

References doWriteProperties().

+ Here is the call graph for this function:

◆ callConstructor()

static void callConstructor ( const QMetaObject targetMetaObject,
int  i,
void source,
void target 
)
static

Definition at line 89 of file qqmlglobal.cpp.

References QMetaObject::ConstructInPlace, i, and QMetaObject::static_metacall().

Referenced by fromMatchingType(), fromString(), and fromVerifiedType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOrConstructValueType() [1/2]

template<typename Allocate , typename DefaultConstruct >
bool createOrConstructValueType ( const QQmlType targetType,
const QV4::Value source,
Allocate &&  allocate,
DefaultConstruct &&  defaultConstruct 
)

Definition at line 444 of file qqmlglobal.cpp.

References QQmlType::canConstructValueType(), QQmlType::canPopulateValueType(), QMetaType::construct(), QQmlType::createValueTypeFunction(), doWriteProperties(), fromMatchingType(), QJSValuePrivate::fromReturnedValue(), QQmlMetaType::metaObjectForValueType(), qWarning, and QQmlType::typeId().

Referenced by QQmlValueTypeProvider::heapCreateValueType(), QQmlValueTypeProvider::populateValueType(), and QQmlValueTypeProvider::populateValueType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOrConstructValueType() [2/2]

template<typename Allocate , typename DefaultConstruct >
bool createOrConstructValueType ( const QQmlType targetType,
QMetaType  sourceMetaType,
void source,
Allocate &&  allocate,
DefaultConstruct &&  defaultConstruct 
)

Definition at line 488 of file qqmlglobal.cpp.

References QQmlType::canConstructValueType(), QQmlType::canPopulateValueType(), doWriteProperties(), QMetaType::flags(), fromMatchingType(), QQmlMetaType::metaObjectForValueType(), QMetaType::PointerToQObject, QMetaObject::property(), and qWarning.

+ Here is the call graph for this function:

◆ createVariantData()

static void * createVariantData ( QMetaType  type,
QVariant variant 
)
static

Definition at line 73 of file qqmlglobal.cpp.

References QVariant::Private::canUseInternalSpace(), QVariant::PrivateShared::create(), d, QVariant::data_ptr(), Q_ASSERT, and variant.

Referenced by QQmlValueTypeProvider::constructValueType(), QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), and QQmlValueTypeProvider::createValueType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ddata_for_cast()

static const QQmlData * ddata_for_cast ( QObject object)
static

Definition at line 912 of file qqmlglobal.cpp.

References QQmlData::get(), and Q_ASSERT.

Referenced by qmlobject_can_cpp_cast(), and qmlobject_can_qml_cast().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doWriteProperties() [1/4]

static void doWriteProperties ( const QMetaObject targetMeta,
void target,
QObject source 
)
static

Definition at line 326 of file qqmlglobal.cpp.

References doWriteProperties().

+ Here is the call graph for this function:

◆ doWriteProperties() [2/4]

template<typename Map >
void doWriteProperties ( const QMetaObject targetMetaObject,
void target,
const Map source 
)

◆ doWriteProperties() [3/4]

template<typename Read >
static void doWriteProperties ( const QMetaObject targetMetaObject,
void target,
const QMetaObject sourceMetaObject,
Read &&  read 
)
static

◆ doWriteProperties() [4/4]

static void doWriteProperties ( const QMetaObject targetMetaObject,
void target,
const QV4::Value source 
)
static

◆ doWriteProperty()

template<typename Get , typename Convert >
static bool doWriteProperty ( const QMetaProperty metaProperty,
void target,
Get &&  get,
Convert &&  convert 
)
static

Definition at line 192 of file qqmlglobal.cpp.

References convert(), QMetaType::convert(), QVariant::data(), get(), QVariant::isValid(), QMetaProperty::metaType(), property, and QMetaProperty::writeOnGadget().

Referenced by doWriteProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromJSValue()

static QVariant fromJSValue ( const QQmlType type,
const QJSValue s,
QMetaType  metaType 
)
static

Definition at line 636 of file qqmlglobal.cpp.

Referenced by QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), and QQmlValueTypeProvider::createValueType().

+ Here is the caller graph for this function:

◆ fromMatchingType() [1/3]

template<typename Allocate , typename Retrieve >
static bool fromMatchingType ( const QMetaObject targetMetaObject,
Allocate &&  allocate,
Retrieve &&  retrieve 
)
static

Definition at line 108 of file qqmlglobal.cpp.

References callConstructor(), QMetaObject::constructor(), QMetaObject::constructorCount(), QMetaType::convert(), QVariant::data(), i, QMetaType::metaObject(), QMetaMethod::parameterCount(), and QMetaMethod::parameterMetaType().

Referenced by createOrConstructValueType(), createOrConstructValueType(), QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), fromMatchingType(), and fromMatchingType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromMatchingType() [2/3]

template<typename Allocate >
static bool fromMatchingType ( const QMetaObject targetMetaObject,
const QV4::Value source,
Allocate &&  allocate 
)
static

Definition at line 153 of file qqmlglobal.cpp.

References QVariant::data(), fromMatchingType(), QVariant::metaType(), QV4::ExecutionEngine::toVariant(), and variant.

+ Here is the call graph for this function:

◆ fromMatchingType() [3/3]

template<typename Allocate >
static bool fromMatchingType ( const QMetaObject targetMetaObject,
QVariant  source,
Allocate &&  allocate 
)
static

Definition at line 165 of file qqmlglobal.cpp.

References fromMatchingType().

+ Here is the call graph for this function:

◆ fromString()

template<typename Allocate >
static bool fromString ( const QMetaObject mo,
QString  s,
Allocate &&  allocate 
)
static

Definition at line 175 of file qqmlglobal.cpp.

References callConstructor(), i, mo, QMetaMethod::parameterCount(), and QMetaMethod::parameterMetaType().

Referenced by QUuid::QUuid(), QQmlValueTypeProvider::createValueType(), and QColor::isValidColorName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromVerifiedType()

template<typename Allocate >
static void fromVerifiedType ( const QMetaObject targetMetaObject,
int  ctorIndex,
void source,
Allocate &&  allocate 
)
static

Definition at line 97 of file qqmlglobal.cpp.

References callConstructor(), QMetaObject::constructor(), QMetaMethod::parameterCount(), and Q_ASSERT_X.

Referenced by QQmlValueTypeProvider::constructValueType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColorProvider()

static QQmlColorProvider ** getColorProvider ( void  )
static

Definition at line 761 of file qqmlglobal.cpp.

References colorProvider, and qWarning.

Referenced by QQml_colorProvider().

+ Here is the caller graph for this function:

◆ getGuiProvider()

static QQmlGuiProvider ** getGuiProvider ( void  )
static

Definition at line 815 of file qqmlglobal.cpp.

References guiProvider.

Referenced by QQml_guiProvider().

+ Here is the caller graph for this function:

◆ isConstructibleMetaType()

static QT_BEGIN_NAMESPACE bool isConstructibleMetaType ( const QMetaType  metaType)
static

Definition at line 17 of file qqmlglobal.cpp.

References QMetaType::flags(), QMetaType::id(), QMetaType::IsEnumeration, QMetaType::IsPointer, QMetaType::IsQmlList, QMetaType::IsUnsignedEnumeration, QMetaType::PointerToGadget, QMetaType::PointerToQObject, QMetaType::QVariant, QMetaType::SharedPointerToQObject, QMetaType::TrackingPointerToQObject, and QMetaType::WeakPointerToQObject.

Referenced by QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::createValueType(), QQmlValueTypeProvider::populateValueType(), and QQmlValueTypeProvider::populateValueType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlobject_can_cpp_cast()

bool qmlobject_can_cpp_cast ( QObject object,
const QMetaObject mo 
)

Definition at line 919 of file qqmlglobal.cpp.

References ddata_for_cast(), mo, and Q_ASSERT.

Referenced by QV4::MatchScore(), and qmlobject_cast().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlobject_can_qml_cast()

bool qmlobject_can_qml_cast ( QObject object,
const QQmlType type 
)

Definition at line 927 of file qqmlglobal.cpp.

References QQmlRefPointer< T >::data(), ddata_for_cast(), QQmlMetaType::findPropertyCacheInCompositeTypes(), and Q_ASSERT.

Referenced by QV4::coerceQObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QQml_colorProvider()

Q_AUTOTEST_EXPORT QQmlColorProvider * QQml_colorProvider ( void  )

Definition at line 772 of file qqmlglobal.cpp.

References getColorProvider().

Referenced by QtObject::alpha(), QQuickColorValueType::alpha(), QQmlStringConverters::colorFromString(), QtObject::darker(), QQuickColorValueType::darker(), QuickTestResult::fuzzyCompare(), QtObject::hsla(), QtObject::hsva(), QtObject::lighter(), QQuickColorValueType::lighter(), QtObject::rgba(), QQmlStringConverters::rgbaFromString(), QtObject::tint(), and QQuickColorValueType::tint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QQml_guiProvider()

Q_AUTOTEST_EXPORT QQmlGuiProvider * QQml_guiProvider ( void  )

Definition at line 825 of file qqmlglobal.cpp.

References getGuiProvider().

Referenced by QtObject::fontFamilies(), QtObject::inputMethod(), QtObject::openUrlExternally(), QQmlPlatform::pluginName(), and QtObject::styleHints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ QQml_setColorProvider()

Q_QML_PRIVATE_EXPORT QQmlColorProvider * QQml_setColorProvider ( QQmlColorProvider newProvider)

Definition at line 754 of file qqmlglobal.cpp.

References colorProvider.

Referenced by QQuick_initializeModule().

+ Here is the caller graph for this function:

◆ QQml_setGuiProvider()

Q_QML_PRIVATE_EXPORT QQmlGuiProvider * QQml_setGuiProvider ( QQmlGuiProvider newProvider)

Definition at line 808 of file qqmlglobal.cpp.

References guiProvider.

Referenced by QQuick_initializeModule().

+ Here is the caller graph for this function:

Variable Documentation

◆ colorProvider

QQmlColorProvider* colorProvider = nullptr
static

Definition at line 752 of file qqmlglobal.cpp.

Referenced by getColorProvider(), getColorProvider(), and QQml_setColorProvider().

◆ guiProvider

QQmlGuiProvider* guiProvider = nullptr
static

Definition at line 806 of file qqmlglobal.cpp.

Referenced by getGuiProvider(), getGuiProvider(), and QQml_setGuiProvider().