Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqml.h File Reference

(c89bdc79f0c29a90bd9a758f7693bf43a1475645)

#include <QtQml/qqmlprivate.h>
#include <QtQml/qjsvalue.h>
#include <QtQml/qqmlregistration.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qmetacontainer.h>
#include <QtCore/qversionnumber.h>
Include dependency graph for qqml.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QQmlTypeNotAvailable
struct  QmlTypeAndRevisionsRegistration< T, Resolved, Extended, false, false, false, false >
struct  QmlTypeAndRevisionsRegistration< T, Resolved, Extended, false, false, false, true >
struct  QmlTypeAndRevisionsRegistration< T, Resolved, void, false, false, true, true >
struct  QmlTypeAndRevisionsRegistration< T, Resolved, Extended, true, false, false, false >
struct  QmlTypeAndRevisionsRegistration< T, Resolved, Extended, true, false, false, true >
struct  QmlTypeAndRevisionsRegistration< T, Resolved, void, false, true, false, false >

Macros

#define QML_VERSION   0x020000
#define QML_VERSION_STR   "2.0"
#define QML_DECLARE_TYPE(TYPE)
#define QML_DECLARE_TYPE_HASMETATYPE(TYPE)
#define QML_DECLARE_INTERFACE(INTERFACE)
#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE)
#define QML_DECLARE_TYPEINFO(TYPE, FLAGS)

Enumerations

enum  { QML_HAS_ATTACHED_PROPERTIES = 0x01 }
enum  QQmlModuleImportSpecialVersions : int { QQmlModuleImportModuleAny = -1 , QQmlModuleImportLatest = -1 , QQmlModuleImportAuto = -2 }

Functions

QT_BEGIN_NAMESPACE void Q_QML_EXPORT qmlClearTypeRegistrations ()
template<class T>
QQmlCustomParserqmlCreateCustomParser ()
template<typename T>
int qmlRegisterAnonymousType (const char *uri, int versionMajor)
template<typename T, int metaObjectRevisionMinor>
int qmlRegisterAnonymousType (const char *uri, int versionMajor)
template<typename T>
void qmlRegisterAnonymousTypesAndRevisions (const char *uri, int versionMajor)
int Q_QML_EXPORT qmlRegisterTypeNotAvailable (const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &message)
template<typename T>
int qmlRegisterUncreatableType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
template<typename T, int metaObjectRevision>
int qmlRegisterUncreatableType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
template<typename T, typename E>
int qmlRegisterExtendedUncreatableType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
template<typename T, typename E, int metaObjectRevision>
int qmlRegisterExtendedUncreatableType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
Q_QML_EXPORT int qmlRegisterUncreatableMetaObject (const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason)
template<typename T>
int qmlRegisterType (const char *uri, int versionMajor, int versionMinor, const char *qmlName)
template<typename T, int metaObjectRevision>
int qmlRegisterType (const char *uri, int versionMajor, int versionMinor, const char *qmlName)
template<typename T, int metaObjectRevision>
int qmlRegisterRevision (const char *uri, int versionMajor, int versionMinor)
template<typename T, typename E>
int qmlRegisterExtendedType (const char *uri, int versionMajor)
template<typename T, typename E>
int qmlRegisterExtendedType (const char *uri, int versionMajor, int versionMinor, const char *qmlName)
template<typename T>
int qmlRegisterInterface (const char *uri, int versionMajor)
template<typename T>
int qmlRegisterCustomType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, QQmlCustomParser *parser)
template<typename T, int metaObjectRevision>
int qmlRegisterCustomType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, QQmlCustomParser *parser)
template<typename T, typename E>
int qmlRegisterCustomExtendedType (const char *uri, int versionMajor, int versionMinor, const char *qmlName, QQmlCustomParser *parser)
Q_QML_EXPORT void qmlExecuteDeferred (QObject *)
 \inmodule QtQml \title Functions to register C++ types to QML
Q_QML_EXPORT QQmlContextqmlContext (const QObject *)
Q_QML_EXPORT QQmlEngineqmlEngine (const QObject *)
Q_QML_EXPORT QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction (QObject *, const QMetaObject *)
Q_QML_EXPORT QObjectqmlAttachedPropertiesObject (QObject *, QQmlAttachedPropertiesFunc func, bool createIfMissing=true)
Q_QML_EXPORT QObjectqmlExtendedObject (QObject *)
Q_QML_EXPORT bool qmlProtectModule (const char *uri, int majVersion)
Q_QML_EXPORT void qmlRegisterModule (const char *uri, int versionMajor, int versionMinor)
Q_QML_EXPORT void qmlRegisterModuleImport (const char *uri, int moduleMajor, const char *import, int importMajor=QQmlModuleImportLatest, int importMinor=QQmlModuleImportLatest)
Q_QML_EXPORT void qmlUnregisterModuleImport (const char *uri, int moduleMajor, const char *import, int importMajor=QQmlModuleImportLatest, int importMinor=QQmlModuleImportLatest)
template<typename T>
QObjectqmlAttachedPropertiesObject (const QObject *obj, bool create=true)
template<typename F, typename std::enable_if< std::is_convertible< F, std::function< QJSValue(QQmlEngine *, QJSEngine *)> >::value, void >::type * = nullptr>
int qmlRegisterSingletonType (const char *uri, int versionMajor, int versionMinor, const char *typeName, F &&callback)
template<typename T, typename F, typename std::enable_if< std::is_convertible< F, std::function< QObject *(QQmlEngine *, QJSEngine *)> >::value, void >::type * = nullptr>
int qmlRegisterSingletonType (const char *uri, int versionMajor, int versionMinor, const char *typeName, F &&callback)
template<typename T>
auto qmlRegisterSingletonInstance (const char *uri, int versionMajor, int versionMinor, const char *typeName, T *cppObject) -> typename std::enable_if< std::is_base_of< QObject, T >::value, int >::type
int qmlRegisterSingletonType (const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName)
int qmlRegisterType (const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName)
template<typename Container>
int qmlRegisterAnonymousSequentialContainer (const char *uri, int versionMajor)
template<typename... T>
void qmlRegisterTypesAndRevisions (const char *uri, int versionMajor, QList< int > *qmlTypeIds)
void qmlRegisterNamespaceAndRevisions (const QMetaObject *metaObject, const char *uri, int versionMajor, QList< int > *qmlTypeIds, const QMetaObject *classInfoMetaObject, const QMetaObject *extensionMetaObject)
void qmlRegisterNamespaceAndRevisions (const QMetaObject *metaObject, const char *uri, int versionMajor, QList< int > *qmlTypeIds=nullptr, const QMetaObject *classInfoMetaObject=nullptr)
template<typename Enum>
void qmlRegisterEnum (const char *name)
int Q_QML_EXPORT qmlTypeId (const char *uri, int versionMajor, int versionMinor, const char *qmlName)

Macro Definition Documentation

◆ QML_DECLARE_INTERFACE

#define QML_DECLARE_INTERFACE ( INTERFACE)
Value:
QML_DECLARE_TYPE(INTERFACE)
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19

Definition at line 26 of file qqml.h.

◆ QML_DECLARE_INTERFACE_HASMETATYPE

#define QML_DECLARE_INTERFACE_HASMETATYPE ( INTERFACE)
Value:
#define QML_DECLARE_TYPE_HASMETATYPE(TYPE)
Definition qqml.h:23

Definition at line 29 of file qqml.h.

◆ QML_DECLARE_TYPE

#define QML_DECLARE_TYPE ( TYPE)
Value:
Q_DECLARE_METATYPE(QQmlListProperty<TYPE>)
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1507
const char * TYPE

Definition at line 19 of file qqml.h.

◆ QML_DECLARE_TYPE_HASMETATYPE

#define QML_DECLARE_TYPE_HASMETATYPE ( TYPE)
Value:

Definition at line 23 of file qqml.h.

◆ QML_DECLARE_TYPEINFO

#define QML_DECLARE_TYPEINFO ( TYPE,
FLAGS )
Value:
QT_BEGIN_NAMESPACE \
template <> \
class QQmlTypeInfo<TYPE > \
{ \
public: \
enum { \
hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \
}; \
}; \
@ QML_HAS_ATTACHED_PROPERTIES
Definition qqml.h:33
#define QT_END_NAMESPACE
const char * FLAGS

Definition at line 36 of file qqml.h.

◆ QML_VERSION

#define QML_VERSION   0x020000

Definition at line 16 of file qqml.h.

◆ QML_VERSION_STR

#define QML_VERSION_STR   "2.0"

Definition at line 17 of file qqml.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
QML_HAS_ATTACHED_PROPERTIES 

Definition at line 32 of file qqml.h.

◆ QQmlModuleImportSpecialVersions

Enumerator
QQmlModuleImportModuleAny 
QQmlModuleImportLatest 
QQmlModuleImportAuto 

Definition at line 647 of file qqml.h.

Function Documentation

◆ qmlAttachedPropertiesFunction()

QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction ( QObject * object,
const QMetaObject * attachedMetaObject )

Definition at line 116 of file qqml.cpp.

◆ qmlAttachedPropertiesObject() [1/2]

template<typename T>
QObject * qmlAttachedPropertiesObject ( const QObject * obj,
bool create = true )

Definition at line 663 of file qqml.h.

◆ qmlAttachedPropertiesObject() [2/2]

QObject * qmlAttachedPropertiesObject ( QObject * object,
QQmlAttachedPropertiesFunc func,
bool createIfMissing = true )

Definition at line 124 of file qqml.cpp.

◆ qmlClearTypeRegistrations()

QT_BEGIN_NAMESPACE void Q_QML_EXPORT qmlClearTypeRegistrations ( )

◆ qmlContext()

QQmlContext * qmlContext ( const QObject * obj)
related

Definition at line 85 of file qqml.cpp.

◆ qmlCreateCustomParser()

template<class T>
QQmlCustomParser * qmlCreateCustomParser ( )

Definition at line 91 of file qqmlprivate.h.

◆ qmlEngine()

QQmlEngine * qmlEngine ( const QObject * obj)
related

Definition at line 90 of file qqml.cpp.

◆ qmlExecuteDeferred()

QT_BEGIN_NAMESPACE void qmlExecuteDeferred ( QObject * object)

\inmodule QtQml \title Functions to register C++ types to QML

This header provides a collection of functions that allow the registration of C++ types to QML.

See also
{Overview - QML and C++ Integration}, qqmlintegration.h, qmltyperegistrar

This method completes the setup of all deferred properties of object. Deferred properties are declared with Q_CLASSINFO("DeferredPropertyNames", "comma,separated,property,list");

Any binding to a deferred property is not executed when the object is instantiated, but only when completion is requested with qmlExecuteDeferred, or by manually calling QQmlComponentPrivate::beginDeferred and completeDeferred.

See also
QV4::CompiledData::Binding::IsDeferredBinding, QV4::CompiledData::Object::HasDeferredBindings, QQmlData::deferData, QQmlObjectCreator::setupBindings

Definition at line 59 of file qqml.cpp.

◆ qmlExtendedObject()

Q_QML_EXPORT QObject * qmlExtendedObject ( QObject * )

◆ qmlProtectModule()

Q_QML_EXPORT bool qmlProtectModule ( const char * uri,
int majVersion )

◆ qmlRegisterAnonymousSequentialContainer()

template<typename Container>
int qmlRegisterAnonymousSequentialContainer ( const char * uri,
int versionMajor )
inline

Definition at line 783 of file qqml.h.

◆ qmlRegisterAnonymousType() [1/2]

template<typename T>
int qmlRegisterAnonymousType ( const char * uri,
int versionMajor )

Definition at line 56 of file qqml.h.

◆ qmlRegisterAnonymousType() [2/2]

template<typename T, int metaObjectRevisionMinor>
int qmlRegisterAnonymousType ( const char * uri,
int versionMajor )

Definition at line 90 of file qqml.h.

◆ qmlRegisterAnonymousTypesAndRevisions()

template<typename T>
void qmlRegisterAnonymousTypesAndRevisions ( const char * uri,
int versionMajor )

Definition at line 128 of file qqml.h.

◆ qmlRegisterCustomExtendedType()

template<typename T, typename E>
int qmlRegisterCustomExtendedType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
QQmlCustomParser * parser )

Definition at line 584 of file qqml.h.

◆ qmlRegisterCustomType() [1/2]

template<typename T>
int qmlRegisterCustomType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
QQmlCustomParser * parser )

Definition at line 510 of file qqml.h.

◆ qmlRegisterCustomType() [2/2]

template<typename T, int metaObjectRevision>
int qmlRegisterCustomType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
QQmlCustomParser * parser )

Definition at line 547 of file qqml.h.

◆ qmlRegisterEnum()

template<typename Enum>
void qmlRegisterEnum ( const char * name)

Definition at line 999 of file qqml.h.

◆ qmlRegisterExtendedType() [1/2]

template<typename T, typename E>
int qmlRegisterExtendedType ( const char * uri,
int versionMajor )

Definition at line 404 of file qqml.h.

◆ qmlRegisterExtendedType() [2/2]

template<typename T, typename E>
int qmlRegisterExtendedType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )

Definition at line 445 of file qqml.h.

◆ qmlRegisterExtendedUncreatableType() [1/2]

template<typename T, typename E>
int qmlRegisterExtendedUncreatableType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & reason )

Definition at line 216 of file qqml.h.

◆ qmlRegisterExtendedUncreatableType() [2/2]

template<typename T, typename E, int metaObjectRevision>
int qmlRegisterExtendedUncreatableType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & reason )

Definition at line 257 of file qqml.h.

◆ qmlRegisterInterface()

template<typename T>
int qmlRegisterInterface ( const char * uri,
int versionMajor )

Definition at line 492 of file qqml.h.

◆ qmlRegisterModule()

Q_QML_EXPORT void qmlRegisterModule ( const char * uri,
int versionMajor,
int versionMinor )

◆ qmlRegisterModuleImport()

Q_QML_EXPORT void qmlRegisterModuleImport ( const char * uri,
int moduleMajor,
const char * import,
int importMajor = QQmlModuleImportLatest,
int importMinor = QQmlModuleImportLatest )

◆ qmlRegisterNamespaceAndRevisions() [1/2]

void qmlRegisterNamespaceAndRevisions ( const QMetaObject * metaObject,
const char * uri,
int versionMajor,
QList< int > * qmlTypeIds,
const QMetaObject * classInfoMetaObject,
const QMetaObject * extensionMetaObject )
inline

Definition at line 948 of file qqml.h.

◆ qmlRegisterNamespaceAndRevisions() [2/2]

void qmlRegisterNamespaceAndRevisions ( const QMetaObject * metaObject,
const char * uri,
int versionMajor,
QList< int > * qmlTypeIds = nullptr,
const QMetaObject * classInfoMetaObject = nullptr )
inline

Definition at line 989 of file qqml.h.

◆ qmlRegisterRevision()

template<typename T, int metaObjectRevision>
int qmlRegisterRevision ( const char * uri,
int versionMajor,
int versionMinor )

Definition at line 372 of file qqml.h.

◆ qmlRegisterSingletonInstance()

template<typename T>
auto qmlRegisterSingletonInstance ( const char * uri,
int versionMajor,
int versionMinor,
const char * typeName,
T * cppObject ) -> typename std::enable_if<std::is_base_of<QObject, T>::value, int>::type
inline

Definition at line 735 of file qqml.h.

◆ qmlRegisterSingletonType() [1/3]

template<typename F, typename std::enable_if< std::is_convertible< F, std::function< QJSValue(QQmlEngine *, QJSEngine *)> >::value, void >::type * = nullptr>
int qmlRegisterSingletonType ( const char * uri,
int versionMajor,
int versionMinor,
const char * typeName,
F && callback )

Definition at line 684 of file qqml.h.

◆ qmlRegisterSingletonType() [2/3]

template<typename T, typename F, typename std::enable_if< std::is_convertible< F, std::function< QObject *(QQmlEngine *, QJSEngine *)> >::value, void >::type * = nullptr>
int qmlRegisterSingletonType ( const char * uri,
int versionMajor,
int versionMinor,
const char * typeName,
F && callback )

Definition at line 711 of file qqml.h.

◆ qmlRegisterSingletonType() [3/3]

int qmlRegisterSingletonType ( const QUrl & url,
const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )
inline

Definition at line 744 of file qqml.h.

◆ qmlRegisterType() [1/3]

template<typename T>
int qmlRegisterType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )

Definition at line 300 of file qqml.h.

◆ qmlRegisterType() [2/3]

template<typename T, int metaObjectRevision>
int qmlRegisterType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )

Definition at line 336 of file qqml.h.

◆ qmlRegisterType() [3/3]

int qmlRegisterType ( const QUrl & url,
const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )
inline

Definition at line 763 of file qqml.h.

◆ qmlRegisterTypeNotAvailable()

int Q_QML_EXPORT qmlRegisterTypeNotAvailable ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & message )

◆ qmlRegisterTypesAndRevisions()

template<typename... T>
void qmlRegisterTypesAndRevisions ( const char * uri,
int versionMajor,
QList< int > * qmlTypeIds )

Definition at line 935 of file qqml.h.

◆ qmlRegisterUncreatableMetaObject()

Q_QML_EXPORT int qmlRegisterUncreatableMetaObject ( const QMetaObject & staticMetaObject,
const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & reason )

◆ qmlRegisterUncreatableType() [1/2]

template<typename T>
int qmlRegisterUncreatableType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & reason )

Definition at line 148 of file qqml.h.

◆ qmlRegisterUncreatableType() [2/2]

template<typename T, int metaObjectRevision>
int qmlRegisterUncreatableType ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName,
const QString & reason )

Definition at line 182 of file qqml.h.

◆ qmlTypeId()

int Q_QML_EXPORT qmlTypeId ( const char * uri,
int versionMajor,
int versionMinor,
const char * qmlName )

◆ qmlUnregisterModuleImport()

Q_QML_EXPORT void qmlUnregisterModuleImport ( const char * uri,
int moduleMajor,
const char * import,
int importMajor = QQmlModuleImportLatest,
int importMinor = QQmlModuleImportLatest )