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
QQmlTypeData Class Reference

#include <qqmltypedata_p.h>

+ Inheritance diagram for QQmlTypeData:
+ Collaboration diagram for QQmlTypeData:

Classes

struct  ScriptReference
 
struct  TypeDataCallback
 
struct  TypeReference
 

Public Member Functions

 ~QQmlTypeData () override
 
QV4::CompiledData::CompilationUnitcompilationUnit () const
 
void registerCallback (TypeDataCallback *)
 
void unregisterCallback (TypeDataCallback *)
 
QQmlType qmlType (const QString &inlineComponentName=QString()) const
 
QByteArray typeClassName () const
 
SourceCodeData backupSourceCode () const
 
- Public Member Functions inherited from QQmlTypeLoader::Blob
 Blob (const QUrl &url, QQmlDataBlob::Type type, QQmlTypeLoader *loader)
 
 ~Blob () override
 
const QQmlImportsimports () const
 
void setCachedUnitStatus (QQmlMetaType::CachedUnitLookupError status)
 
void importQmldirScripts (const PendingImportPtr &import, const QQmlTypeLoaderQmldirContent &qmldir, const QUrl &qmldirUrl)
 
- Public Member Functions inherited from QQmlDataBlob
 QQmlDataBlob (const QUrl &, Type, QQmlTypeLoader *manager)
 Create a new QQmlDataBlob for url and of the provided type.
 
virtual ~QQmlDataBlob ()
 
void startLoading ()
 Must be called before loading can occur.
 
QQmlTypeLoadertypeLoader () const
 
Type type () const
 Returns the type provided to the constructor.
 
Status status () const
 Returns the blob's status.
 
bool isNull () const
 Returns true if the status is Null.
 
bool isLoading () const
 Returns true if the status is Loading.
 
bool isWaiting () const
 Returns true if the status is WaitingForDependencies.
 
bool isComplete () const
 Returns true if the status is Complete.
 
bool isError () const
 Returns true if the status is Error.
 
bool isCompleteOrError () const
 Returns true if the status is Complete or Error.
 
qreal progress () const
 Returns the data download progress from 0 to 1.
 
QUrl url () const
 Returns the physical url of the data.
 
QString urlString () const
 
QUrl finalUrl () const
 Returns the logical URL to be used for resolving further URLs referred to in the code.
 
QString finalUrlString () const
 Returns the finalUrl() as a string.
 
QList< QQmlErrorerrors () const
 Return the errors on this blob.
 
- Public Member Functions inherited from QQmlRefCounted< QQmlDataBlob >
void release () const
 
- Public Member Functions inherited from QQmlRefCount
 QQmlRefCount ()
 
void addref () const
 
int count () const
 

Protected Member Functions

void done () override
 Invoked once data has either been received or a network error occurred, and all dependencies are complete.
 
void completed () override
 Invoked on the main thread sometime after done() was called on the load thread.
 
void dataReceived (const SourceCodeData &) override
 Invoked when data for the blob is received.
 
void initializeFromCachedUnit (const QQmlPrivate::CachedQmlUnit *unit) override
 
void allDependenciesDone () override
 Called when all blobs waited for have completed.
 
void downloadProgressChanged (qreal) override
 Called when the download progress of this blob changes.
 
QString stringAt (int index) const override
 
- Protected Member Functions inherited from QQmlTypeLoader::Blob
bool addImport (const QV4::CompiledData::Import *import, QQmlImports::ImportFlags, QList< QQmlError > *errors)
 
bool addImport (PendingImportPtr import, QList< QQmlError > *errors)
 
bool fetchQmldir (const QUrl &url, PendingImportPtr import, int priority, QList< QQmlError > *errors)
 
bool updateQmldir (const QQmlRefPointer< QQmlQmldirData > &data, const PendingImportPtr &import, QList< QQmlError > *errors)
 
bool loadDependentImports (const QList< QQmlDirParser::Import > &imports, const QString &qualifier, QTypeRevision version, quint16 precedence, QQmlImports::ImportFlags flags, QList< QQmlError > *errors)
 
bool isDebugging () const
 
bool readCacheFile () const
 
bool writeCacheFile () const
 
QQmlMetaType::CacheMode aotCacheMode () const
 
- Protected Member Functions inherited from QQmlDataBlob
void setError (const QQmlError &)
 Mark this blob as having errors.
 
void setError (const QList< QQmlError > &errors)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setError (const QQmlJS::DiagnosticMessage &error)
 
void setError (const QString &description)
 
void addDependency (QQmlDataBlob *)
 Wait for blob to become complete or to error.
 
virtual void dependencyError (QQmlDataBlob *)
 Called if blob, which was previously waited for, has an error.
 
- Protected Member Functions inherited from QQmlRefCounted< QQmlDataBlob >
 ~QQmlRefCounted ()
 

Private Member Functions

void scriptImported (const QQmlRefPointer< QQmlScriptBlob > &blob, const QV4::CompiledData::Location &location, const QString &nameSpace, const QString &qualifier) override
 

Friends

class QQmlTypeLoader
 

Additional Inherited Members

- Public Types inherited from QQmlTypeLoader::Blob
using PendingImportPtr = std::shared_ptr<PendingImport>
 
- Public Types inherited from QQmlDataBlob
enum  Status {
  Null , Loading , WaitingForDependencies , ResolvingDependencies ,
  Complete , Error
}
 This enum describes the status of the data blob. More...
 
enum  Type { QmlFile = QQmlAbstractUrlInterceptor::QmlFile , JavaScriptFile = QQmlAbstractUrlInterceptor::JavaScriptFile , QmldirFile = QQmlAbstractUrlInterceptor::QmldirFile }
 This enum describes the type of the data blob. More...
 
using Ptr = QQmlRefPointer<QQmlDataBlob>
 
- Protected Attributes inherited from QQmlTypeLoader::Blob
QQmlRefPointer< QQmlImportsm_importCache
 
QVector< PendingImportPtrm_unresolvedImports
 
QVector< QQmlRefPointer< QQmlQmldirData > > m_qmldirs
 
QQmlMetaType::CachedUnitLookupError m_cachedUnitStatus = QQmlMetaType::CachedUnitLookupError::NoError
 
- Protected Attributes inherited from QQmlDataBlob
QQmlTypeLoaderm_typeLoader
 
QList< QQmlDataBlob * > m_waitingOnMe
 

Detailed Description

Definition at line 23 of file qqmltypedata_p.h.

Constructor & Destructor Documentation

◆ ~QQmlTypeData()

QQmlTypeData::~QQmlTypeData ( )
override

Definition at line 47 of file qqmltypedata.cpp.

Member Function Documentation

◆ allDependenciesDone()

void QQmlTypeData::allDependenciesDone ( )
overrideprotectedvirtual

Called when all blobs waited for have completed.

This occurs regardless of whether they are in error, or complete state.

The default implementation does nothing.

Reimplemented from QQmlDataBlob.

Definition at line 767 of file qqmltypedata.cpp.

References QQmlDataBlob::allDependenciesDone(), QQmlImports::baseUrl(), error, QQmlDataBlob::errors(), it, QQmlTypeLoader::Blob::m_importCache, QQmlTypeLoader::Blob::m_unresolvedImports, QList< T >::prepend(), QQmlDataBlob::setError(), and QList< T >::size().

+ Here is the call graph for this function:

◆ backupSourceCode()

SourceCodeData QQmlTypeData::backupSourceCode ( ) const
inline

Definition at line 71 of file qqmltypedata_p.h.

◆ compilationUnit()

QV4::CompiledData::CompilationUnit * QQmlTypeData::compilationUnit ( ) const

Definition at line 54 of file qqmltypedata.cpp.

References QQmlRefPointer< T >::data().

Referenced by done().

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

◆ completed()

void QQmlTypeData::completed ( )
overrideprotectedvirtual

Invoked on the main thread sometime after done() was called on the load thread.

You cannot modify the blobs state at all in this callback and cannot depend on the order or timeliness of these callbacks. Implementors should use this callback to notify dependencies on the main thread that the blob is done and not a lot else.

This callback is only invoked if an asynchronous load for this blob is made. An asynchronous load is one in which the Asynchronous mode is specified explicitly, or one that is implicitly delayed due to a network operation.

The default implementation does nothing.

Reimplemented from QQmlDataBlob.

Definition at line 586 of file qqmltypedata.cpp.

References QQmlTypeData::TypeDataCallback::typeDataReady().

+ Here is the call graph for this function:

◆ dataReceived()

void QQmlTypeData::dataReceived ( const SourceCodeData & )
overrideprotectedvirtual

Invoked when data for the blob is received.

Implementors should use this callback to determine a blob's dependencies. Within this callback you may call setError() or addDependency().

Implements QQmlDataBlob.

Definition at line 630 of file qqmltypedata.cpp.

References QQmlDataBlob::SourceCodeData::exists(), QQmlDataBlob::SourceCodeData::isEmpty(), QQmlDataBlob::isError(), QQmlTypeLoader::Blob::m_cachedUnitStatus, QQmlDataBlob::setError(), and QQmlMetaType::VersionMismatch.

+ Here is the call graph for this function:

◆ done()

void QQmlTypeData::done ( )
overrideprotectedvirtual

Invoked once data has either been received or a network error occurred, and all dependencies are complete.

You can set an error in this method, but you cannot add new dependencies. Implementors should use this callback to finalize processing of data.

The default implementation does nothing.

XXX Rename processData() or some such to avoid confusion between done() (processing thread) and completed() (main thread)

Reimplemented from QQmlDataBlob.

Definition at line 352 of file qqmltypedata.cpp.

References QQmlTypeNameCache::add(), addTypeReferenceChecksumsToHash(), arg, begin(), QQmlPropertyCacheCreatorBase::canCreateClassNameTypeByUrl(), QHash< Key, T >::clear(), QV4::CompiledData::Location::column(), compilationUnit(), QQmlRefPointer< T >::data(), QScopedPointer< T, Cleanup >::data(), QV4::CompiledData::CompilationUnit::dependentScripts, engine, QQmlMetaType::equalBaseUrls(), error, QQmlDataBlob::errors(), QV4::CompiledData::CompilationUnit::fileName(), QV4::CompiledData::CompilationUnit::finalizeCompositeType(), QQmlDataBlob::finalUrl(), QQmlMetaType::findCompositeType(), QV4::CompiledData::Unit::flags, QQmlEnginePrivate::get(), hash, QV4::CompiledData::CompilationUnit::inlineComponentData, QQmlDataBlob::isCompleteOrError(), QList< T >::isEmpty(), QQmlDataBlob::isError(), QScopedPointer< T, Cleanup >::isNull(), QV4::CompiledData::Unit::IsSingleton, QmlIR::Document::isSingleton(), it, QString::lastIndexOf(), QString::left(), QV4::CompiledData::Location::line(), QQmlTypeData::ScriptReference::location, QQmlTypeLoader::Blob::m_importCache, QCryptographicHash::Md5, QString::mid(), QMetaType::name(), QQmlMetaType::NonSingleton, QQmlMetaType::obtainCompilationUnit(), QList< T >::prepend(), Q_ASSERT, QByteArray(), qCDebug, qDeleteAll(), qmlType(), QQmlMetaType::qmlType(), qScopeGuard(), QQmlTypeData::ScriptReference::qualifier, QScopedPointer< T, Cleanup >::reset(), QQmlRefPointer< T >::reset(), QV4::CompiledData::CompilationUnit::resolvedTypes, QQmlTypeData::ScriptReference::script, QQmlScriptBlob::scriptData(), QQmlDataBlob::setError(), QQmlMetaType::Singleton, stringAt(), QQmlDataBlob::type(), QQmlType::typeId(), QQmlDataBlob::typeLoader(), typeName, QV4::CompiledData::CompilationUnit::typeNameCache, QV4::CompiledData::CompilationUnit::unitData(), QQmlDataBlob::url(), QQmlDataBlob::urlString(), QQmlPropertyValidator::validate(), and QV4::CompiledData::CompilationUnit::verifyChecksum().

+ Here is the call graph for this function:

◆ downloadProgressChanged()

void QQmlTypeData::downloadProgressChanged ( qreal progress)
overrideprotectedvirtual

Called when the download progress of this blob changes.

progress goes from 0 to 1.

This callback is only invoked if an asynchronous load for this blob is made. An asynchronous load is one in which the Asynchronous mode is specified explicitly, or one that is implicitly delayed due to a network operation.

The default implementation does nothing.

Reimplemented from QQmlDataBlob.

Definition at line 803 of file qqmltypedata.cpp.

References QQmlTypeData::TypeDataCallback::typeDataProgress().

+ Here is the call graph for this function:

◆ initializeFromCachedUnit()

void QQmlTypeData::initializeFromCachedUnit ( const QQmlPrivate::CachedQmlUnit * unit)
overrideprotectedvirtual

◆ qmlType()

QQmlType QQmlTypeData::qmlType ( const QString & inlineComponentName = QString()) const

Definition at line 72 of file qqmltypedata.cpp.

References QString::isEmpty().

Referenced by done(), and QQmlTypeCompiler::qmlTypeForComponent().

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

◆ registerCallback()

void QQmlTypeData::registerCallback ( TypeDataCallback * callback)

Definition at line 59 of file qqmltypedata.cpp.

References Q_ASSERT.

Referenced by QQmlComponentPrivate::loadUrl().

+ Here is the caller graph for this function:

◆ scriptImported()

void QQmlTypeData::scriptImported ( const QQmlRefPointer< QQmlScriptBlob > & blob,
const QV4::CompiledData::Location & location,
const QString & nameSpace,
const QString & qualifier )
overrideprivatevirtual

Reimplemented from QQmlTypeLoader::Blob.

Definition at line 1098 of file qqmltypedata.cpp.

References QString::isEmpty(), and QQmlTypeData::ScriptReference::script.

+ Here is the call graph for this function:

◆ stringAt()

QString QQmlTypeData::stringAt ( int index) const
overrideprotectedvirtual

Reimplemented from QQmlTypeLoader::Blob.

Definition at line 811 of file qqmltypedata.cpp.

References QmlIR::Document::jsGenerator, QV4::CompiledData::CompilationUnit::stringAt(), QV4::Compiler::StringTableGenerator::stringForIndex(), and QV4::Compiler::JSUnitGenerator::stringTable.

Referenced by done().

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

◆ typeClassName()

QByteArray QQmlTypeData::typeClassName ( ) const
inline

Definition at line 70 of file qqmltypedata_p.h.

Referenced by QQmlTypeCompiler::compile().

+ Here is the caller graph for this function:

◆ unregisterCallback()

void QQmlTypeData::unregisterCallback ( TypeDataCallback * callback)

Definition at line 65 of file qqmltypedata.cpp.

References Q_ASSERT.

Referenced by QQmlComponentPrivate::clear().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QQmlTypeLoader

friend class QQmlTypeLoader
friend

Definition at line 49 of file qqmltypedata_p.h.


The documentation for this class was generated from the following files: