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
qqmlglobal.cpp File Reference

(4d13ed6a598c142f9ed9928fa0bdcb395e4b94cc)

#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_EXPORT QQmlColorProviderQQml_setColorProvider (QQmlColorProvider *newProvider)
 
static QQmlColorProvider ** getColorProvider (void)
 
Q_AUTOTEST_EXPORT QQmlColorProviderQQml_colorProvider (void)
 
Q_QML_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(), QQmlType::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 489 of file qqmlglobal.cpp.

References QQmlType::canConstructValueType(), QQmlType::canPopulateValueType(), doWriteProperties(), fromMatchingType(), QQmlType::metaObjectForValueType(), QQmlMetaType::metaObjectForValueType(), QMetaType::PointerToQObject, 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 910 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

Definition at line 284 of file qqmlglobal.cpp.

References QLatin1StringView::arg(), QMetaType::convert(), QQmlValueTypeProvider::createValueType(), QVariant::data(), QString::fromUtf8(), i, QVariant::isValid(), QMetaProperty::metaType(), QMetaProperty::name(), QMetaType::name(), QMetaObject::property(), property, QMetaObject::propertyCount(), qWarning, read(), and QMetaProperty::writeOnGadget().

+ Here is the call graph for this function:

◆ doWriteProperties() [4/4]

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

Definition at line 218 of file qqmlglobal.cpp.

References QLatin1StringView::arg(), QMetaType::convert(), QQmlValueTypeProvider::createValueType(), QVariant::data(), doWriteProperty(), QV4::Scope::engine, QString::fromUtf8(), i, QVariant::isValid(), QMetaProperty::metaType(), QMetaProperty::name(), QMetaType::name(), QV4::ExecutionEngine::newString(), o, QMetaObject::property(), property, QMetaObject::propertyCount(), qWarning, QV4::ExecutionEngine::toVariant(), and QMetaProperty::writeOnGadget().

Referenced by byProperties(), byProperties(), byProperties(), byProperties(), createOrConstructValueType(), createOrConstructValueType(), and doWriteProperties().

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

◆ 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 639 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, and QMetaType::metaObject().

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, and mo.

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(), 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 769 of file qqmlglobal.cpp.

References colorProvider, and qWarning.

Referenced by QQml_colorProvider(), and QQuick_initializeModule().

+ Here is the caller graph for this function:

◆ getGuiProvider()

static QQmlGuiProvider ** getGuiProvider ( void )
static

Definition at line 823 of file qqmlglobal.cpp.

References guiProvider.

Referenced by QQml_guiProvider(), and QQuick_initializeModule().

+ 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 917 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 925 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 780 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 833 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_EXPORT QQmlColorProvider * QQml_setColorProvider ( QQmlColorProvider * newProvider)

Definition at line 762 of file qqmlglobal.cpp.

References colorProvider.

Referenced by QQuick_initializeModule().

+ Here is the caller graph for this function:

◆ QQml_setGuiProvider()

Q_QML_EXPORT QQmlGuiProvider * QQml_setGuiProvider ( QQmlGuiProvider * newProvider)

Definition at line 816 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 760 of file qqmlglobal.cpp.

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

◆ guiProvider

QQmlGuiProvider* guiProvider = nullptr
static

Definition at line 814 of file qqmlglobal.cpp.

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