![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QQmlImports class encapsulates one QML document's import statements. More...
#include <qqmlimport_p.h>
Classes | |
| struct | ScriptReference |
| struct | CompositeSingletonReference |
Public Types | |
| enum | ImportVersion { FullyVersioned , PartiallyVersioned , Unversioned } |
| enum | ImportFlag : quint8 { ImportNoFlag = 0x0 , ImportIncomplete = 0x1 } |
Public Member Functions | |
| QQmlImports ()=default | |
| ~QQmlImports () | |
| void | setBaseUrl (const QUrl &url, const QString &urlString=QString()) |
| Sets the base URL to be used for all relative file imports added. | |
| QUrl | baseUrl () const |
| bool | resolveType (QQmlTypeLoader *typeLoader, const QHashedStringRef &type, QQmlType *type_return, QTypeRevision *version_return, QQmlImportNamespace **ns_return, QList< QQmlError > *errors=nullptr, QQmlType::RegistrationType registrationType=QQmlType::AnyRegistrationType, bool *typeRecursionDetected=nullptr) const |
| QTypeRevision | addImplicitImport (QQmlTypeLoader *typeLoader, QString *localQmldir, QList< QQmlError > *errors) |
| bool | addInlineComponentImport (QQmlImportInstance *const importInstance, const QString &name, const QUrl &importUrl) |
| QTypeRevision | addFileImport (QQmlTypeLoader *typeLoader, const QString &uri, const QString &prefix, QTypeRevision requestedVersion, ImportFlags flags, quint8 precedence, QString *localQmldir, QList< QQmlError > *errors) |
| QTypeRevision | addLibraryImport (QQmlTypeLoader *typeLoader, const QString &uri, const QString &prefix, QTypeRevision requestedVersion, const QString &qmldirIdentifier, const QString &qmldirUrl, ImportFlags flags, quint8 precedence, QList< QQmlError > *errors) |
| QTypeRevision | updateQmldirContent (QQmlTypeLoader *typeLoader, const QString &uri, QTypeRevision version, const QString &prefix, const QString &qmldirIdentifier, const QString &qmldirUrl, QList< QQmlError > *errors) |
| void | populateCache (QQmlTypeNameCache *cache) const |
| QList< ScriptReference > | resolvedScripts () const |
| QList< CompositeSingletonReference > | resolvedCompositeSingletons () const |
| Public Member Functions inherited from QQmlRefCounted< QQmlImports > | |
| void | release () const |
| Public Member Functions inherited from QQmlRefCount | |
| QQmlRefCount () | |
| void | addref () const |
| int | count () const |
Static Public Member Functions | |
| static QStringList | completeQmldirPaths (const QString &uri, const QStringList &basePaths, QTypeRevision version) |
| Forms complete paths to a qmldir file, from a base URL, a module URI and version specification. | |
| static QString | versionString (QTypeRevision version, ImportVersion importVersion) |
| static bool | isLocal (const QString &url) |
| static bool | isLocal (const QUrl &url) |
| static QUrl | urlFromLocalFileOrQrcOrUrl (const QString &) |
| static void | setDesignerSupportRequired (bool b) |
| static QTypeRevision | validVersion (QTypeRevision version=QTypeRevision()) |
| static QQmlError | moduleNotFoundError (const QString &uri, QTypeRevision version) |
Additional Inherited Members | |
| Protected Member Functions inherited from QQmlRefCounted< QQmlImports > | |
| ~QQmlRefCounted () | |
The QQmlImports class encapsulates one QML document's import statements.
Definition at line 122 of file qqmlimport_p.h.
| enum QQmlImports::ImportFlag : quint8 |
| Enumerator | |
|---|---|
| ImportNoFlag | |
| ImportIncomplete | |
Definition at line 129 of file qqmlimport_p.h.
| Enumerator | |
|---|---|
| FullyVersioned | |
| PartiallyVersioned | |
| Unversioned | |
Definition at line 127 of file qqmlimport_p.h.
|
default |
|
inline |
Definition at line 136 of file qqmlimport_p.h.
| QTypeRevision QQmlImports::addFileImport | ( | QQmlTypeLoader * | typeLoader, |
| const QString & | uri, | ||
| const QString & | prefix, | ||
| QTypeRevision | requestedVersion, | ||
| ImportFlags | flags, | ||
| quint8 | precedence, | ||
| QString * | localQmldir, | ||
| QList< QQmlError > * | errors ) |
Adds information to database such that subsequent calls to resolveType() will resolve types qualified by prefix by considering types found at the given uri.
The uri is either a directory (if importType is FileImport), or a URI resolved using paths added via addImportPath() (if importType is LibraryImport).
The prefix may be empty, in which case the import location is considered for unqualified types.
The base URL must already have been set with Import::setBaseUrl().
Optionally, the qmldir the import resolved to can be returned by providing the localQmldir parameter. Not all imports will have a local qmldir. If there is none, the localQmldir parameter won't be set.
Returns a valid QTypeRevision on success, and an invalid one on failure. In case of failure, the errors array will filled appropriately.
Definition at line 1254 of file qqmlimport.cpp.
|
inline |
Adds an implicit "." file import. This is equivalent to calling addFileImport(), but error messages related to the path or qmldir file not existing are suppressed.
Additionally, this will add the import with lowest instead of highest precedence.
Definition at line 152 of file qqmlimport_p.h.
| bool QQmlImports::addInlineComponentImport | ( | QQmlImportInstance *const | importInstance, |
| const QString & | name, | ||
| const QUrl & | importUrl ) |
Definition at line 1509 of file qqmlimport.cpp.
| QTypeRevision QQmlImports::addLibraryImport | ( | QQmlTypeLoader * | typeLoader, |
| const QString & | uri, | ||
| const QString & | prefix, | ||
| QTypeRevision | requestedVersion, | ||
| const QString & | qmldirIdentifier, | ||
| const QString & | qmldirUrl, | ||
| ImportFlags | flags, | ||
| quint8 | precedence, | ||
| QList< QQmlError > * | errors ) |
Definition at line 1154 of file qqmlimport.cpp.
|
inline |
Returns the base URL to be used for all relative file imports added.
Definition at line 143 of file qqmlimport_p.h.
|
static |
Forms complete paths to a qmldir file, from a base URL, a module URI and version specification.
For example, QtQml.Models 2.0:
Definition at line 406 of file qqmlimport.cpp.
|
inlinestatic |
Definition at line 210 of file qqmlimport_p.h.
|
inlinestatic |
Definition at line 215 of file qqmlimport_p.h.
|
static |
Definition at line 169 of file qqmlimport.cpp.
| void QQmlImports::populateCache | ( | QQmlTypeNameCache * | cache | ) | const |
Definition at line 222 of file qqmlimport.cpp.
| QList< QQmlImports::CompositeSingletonReference > QQmlImports::resolvedCompositeSingletons | ( | ) | const |
Definition at line 323 of file qqmlimport.cpp.
| QList< QQmlImports::ScriptReference > QQmlImports::resolvedScripts | ( | ) | const |
Definition at line 358 of file qqmlimport.cpp.
| bool QQmlImports::resolveType | ( | QQmlTypeLoader * | typeLoader, |
| const QHashedStringRef & | type, | ||
| QQmlType * | type_return, | ||
| QTypeRevision * | version_return, | ||
| QQmlImportNamespace ** | ns_return, | ||
| QList< QQmlError > * | errors = nullptr, | ||
| QQmlType::RegistrationType | registrationType = QQmlType::AnyRegistrationType, | ||
| bool * | typeRecursionDetected = nullptr ) const |
The given (namespace qualified) type is resolved to either \list
If any return pointer is 0, the corresponding search is not done.
Definition at line 440 of file qqmlimport.cpp.
Sets the base URL to be used for all relative file imports added.
Definition at line 195 of file qqmlimport.cpp.
|
static |
Definition at line 1531 of file qqmlimport.cpp.
| QTypeRevision QQmlImports::updateQmldirContent | ( | QQmlTypeLoader * | typeLoader, |
| const QString & | uri, | ||
| QTypeRevision | version, | ||
| const QString & | prefix, | ||
| const QString & | qmldirIdentifier, | ||
| const QString & | qmldirUrl, | ||
| QList< QQmlError > * | errors ) |
Definition at line 1423 of file qqmlimport.cpp.
Definition at line 1521 of file qqmlimport.cpp.
|
static |
Definition at line 186 of file qqmlimport.cpp.
|
static |
Definition at line 415 of file qqmlimport.cpp.