![]() |
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 | CompositeSingletonReference |
struct | ScriptReference |
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, quint16 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, quint16 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 |
![]() | |
void | release () const |
![]() | |
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 | |
![]() | |
~QQmlRefCounted () | |
The QQmlImports class encapsulates one QML document's import statements.
Definition at line 121 of file qqmlimport_p.h.
enum QQmlImports::ImportFlag : quint8 |
Enumerator | |
---|---|
ImportNoFlag | |
ImportIncomplete |
Definition at line 128 of file qqmlimport_p.h.
Enumerator | |
---|---|
FullyVersioned | |
PartiallyVersioned | |
Unversioned |
Definition at line 126 of file qqmlimport_p.h.
|
default |
|
inline |
Definition at line 135 of file qqmlimport_p.h.
QTypeRevision QQmlImports::addFileImport | ( | QQmlTypeLoader * | typeLoader, |
const QString & | uri, | ||
const QString & | prefix, | ||
QTypeRevision | requestedVersion, | ||
ImportFlags | flags, | ||
quint16 | 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 1281 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 151 of file qqmlimport_p.h.
bool QQmlImports::addInlineComponentImport | ( | QQmlImportInstance *const | importInstance, |
const QString & | name, | ||
const QUrl & | importUrl ) |
Definition at line 1547 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, | ||
quint16 | precedence, | ||
QList< QQmlError > * | errors ) |
Definition at line 1180 of file qqmlimport.cpp.
|
inline |
Returns the base URL to be used for all relative file imports added.
Definition at line 142 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 405 of file qqmlimport.cpp.
|
inlinestatic |
Definition at line 209 of file qqmlimport_p.h.
|
inlinestatic |
Definition at line 214 of file qqmlimport_p.h.
|
static |
Definition at line 168 of file qqmlimport.cpp.
void QQmlImports::populateCache | ( | QQmlTypeNameCache * | cache | ) | const |
Definition at line 221 of file qqmlimport.cpp.
QList< QQmlImports::CompositeSingletonReference > QQmlImports::resolvedCompositeSingletons | ( | ) | const |
Definition at line 322 of file qqmlimport.cpp.
QList< QQmlImports::ScriptReference > QQmlImports::resolvedScripts | ( | ) | const |
Definition at line 357 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 439 of file qqmlimport.cpp.
Sets the base URL to be used for all relative file imports added.
Definition at line 194 of file qqmlimport.cpp.
|
static |
Definition at line 1569 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 1461 of file qqmlimport.cpp.
Definition at line 1559 of file qqmlimport.cpp.
|
static |
Definition at line 185 of file qqmlimport.cpp.
|
static |
Definition at line 414 of file qqmlimport.cpp.