![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qqmltccompilerpieces_p.h>
Classes | |
| struct | TranslationBindingInfo |
| struct | PreparedValue |
Public Types | |
| using | InlineComponentOrDocumentRootName = QQmlJSScope::InlineComponentOrDocumentRootName |
| using | RootDocumentNameType = QQmlJSScope::RootDocumentNameType |
Public Attributes | |
| QString | documentUrl |
| Visitor * | visitor = nullptr |
Static Public Attributes | |
| static const QString | privateEngineName = u"ePriv"_s |
| static const QString | typeCountName = u"q_qmltc_typeCount"_s |
Helper class that generates code for the output IR. Takes care of complicated, repetitive, nasty logic which is better kept in a single confined place.
Definition at line 41 of file qqmltccompilerpieces_p.h.
| using QQmltc::CodeGenerator::InlineComponentOrDocumentRootName = QQmlJSScope::InlineComponentOrDocumentRootName |
Definition at line 49 of file qqmltccompilerpieces_p.h.
Definition at line 50 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 89 of file qqmltccompilerpieces.cpp.
|
static |
Definition at line 117 of file qqmltccompilerpieces.cpp.
|
inline |
Generates {current.beginClass}'s code. The beginClass method optionally calls QQmlParserStatus::classBegin() when type implements the corresponding interface.
Definition at line 585 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 177 of file qqmltccompilerpieces.cpp.
|
inline |
Generates {current.completeComponent}'s code. The completeComponent method optionally calls QQmlParserStatus::componentComplete() when type implements the corresponding interface.
Definition at line 599 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 214 of file qqmltccompilerpieces.cpp.
|
static |
Definition at line 290 of file qqmltccompilerpieces.cpp.
|
inline |
Generates {current.endInit}'s code. The endInit method creates bindings, connects signals with slots and generally performs other within-object initialization. Additionally, the QML document root's endInit calls endInit methods of all the necessary QML types within the document.
Definition at line 449 of file qqmltccompilerpieces_p.h.
|
inline |
Generates {current.finalizeComponent}'s code. The finalizeComponent method optionally calls QQmlFinalizerHook::componentFinalized() when type implements the corresponding interface.
Definition at line 614 of file qqmltccompilerpieces_p.h.
|
inlinestatic |
|
inline |
Generates {current.handleOnCompleted}'s code. The handleOnCompleted method optionally calls a Component.onCompleted handler if that is present in type.
Definition at line 629 of file qqmltccompilerpieces_p.h.
|
inlinenodiscard |
Generates {current.init}'s code. The init method sets up a QQmlContext for the object and (in case type is a document root) calls other object creation methods, and a user-provided initialization callback, in a well-defined order:
This function returns a QScopeGuard with the final instructions that have to be generated at a later point, once everything else is compiled.
Definition at line 183 of file qqmltccompilerpieces_p.h.
|
inline |
Generates {current.init}'s code in case when type is a top-level Component type. The init method in this case mimics QQmlObjectCreator::createComponent() logic.
Definition at line 352 of file qqmltccompilerpieces_p.h.
|
inline |
A generic helper function that generates interface code boilerplate, adding it to a passed function. This is a building block used to generate e.g. QQmlParserStatus API calls.
Definition at line 513 of file qqmltccompilerpieces_p.h.
|
inline |
A generic helper function that generates special qmltc instruction code boilerplate, adding it to a passed function. This is a building block used to generate e.g. QML_endInit code.
Definition at line 396 of file qqmltccompilerpieces_p.h.
|
inline |
Generates {current.setComplexBindings}'s code. The setComplexBindings method creates complex bindings (such as script bindings). Additionally, the QML document root's setComplexBindings calls setComplexBindings methods of all the necessary QML types within the document.
Definition at line 491 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 167 of file qqmltccompilerpieces.cpp.
|
inline |
Definition at line 89 of file qqmltccompilerpieces_p.h.
|
inline |
Generate the constexpr typeCount expression for given inlinedComponent. Leave inlinedComponent empty to generate the expression for the main component.
Generates a constexpr function consisting of a sum of type counts for a current QML document. Predicate p acts as a stop condition to prematurely end the sum generation.
The high-level idea:
Each qmltc-compiled document root has a notion of type count. Type count is a number of types the current QML document contains (except for Component-wrapped types) plus the sum of all type counts of all the QML documents used in the current document: if current document has a type with QML base type, this type's type count is added to the type count of the current document.
To be able to lookup created objects during the creation process, one needs to know an index of each object within the document + an offset of the document. Index comes from QmltcVisitor and is basically a serial number of a type in the document (index < type count of the document root type). The offset is more indirect.
The current document always starts with an offset of 0, each type that has a QML base type also "has a sub-document". Each sub-document has a non-0 offset X, where X is calculated as a sum of the current document's type count and a cumulative type count of all the previous sub-documents that appear before the sub-document of interest:
As all objects are put into an array, schematically you can look at it in the following way:
For the object lookup logic itself, see QQmltcObjectCreationHelper
Definition at line 696 of file qqmltccompilerpieces_p.h.
|
inline |
Definition at line 155 of file qqmltccompilerpieces_p.h.
Definition at line 360 of file qqmltccompilerpieces.cpp.
|
static |
Definition at line 28 of file qqmltccompilerpieces.cpp.
|
static |
Definition at line 320 of file qqmltccompilerpieces.cpp.
|
static |
Definition at line 351 of file qqmltccompilerpieces.cpp.
| QString QQmltc::CodeGenerator::documentUrl |
Definition at line 46 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 43 of file qqmltccompilerpieces_p.h.
|
static |
Definition at line 44 of file qqmltccompilerpieces_p.h.
Definition at line 47 of file qqmltccompilerpieces_p.h.