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
qqmlfinalizer.cpp
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
<
private
/
qqmlfinalizer_p
.
h
>
6
7
QT_BEGIN_NAMESPACE
8
9
QQmlFinalizerHook::~QQmlFinalizerHook() =
default
;
10
11
/*!
12
\class QQmlFinalizerHook
13
\internal
14
15
QQmlFinalizerHook is an internal interface to run code after the current toplevel
16
component has been completed.
17
At first, this might look like QQmlParserStaus' componentComplete functionality
18
by another name - however there is a difference. To understand it, consider the
19
following QML file:
20
21
\qml
22
import QtQuick
23
Item {
24
id: root
25
Rectangle {
26
id: rect
27
Rectangle { id: innerRect }
28
}
29
property Item it: Item {id: myItem }
30
}
31
\endqml
32
33
This file will instantiate 4 (sub-)components: One for each of root, rect, innerRect
34
and myItem. If the component gets loaded in a synchronous way, each of their
35
componentComplete (if existent) would run directly one after another (in a non-specified
36
order).
37
38
However, in the case of an asynchronous instantiation, e.g. via a loader, we might interrupt
39
the (sub-)component construction partway: There can be a delay between the various
40
componentComplete calls, and not all sub-components might have been constructed yet.
41
QQmlFinalizerHook::componentFinalized is instead called after all asynchronously instantiated
42
(sub-)components have been constructed. Notably, all bindings of those components have also
43
been set up.
44
45
\note While the engine does not use qobject_cast, tooling still relies on the interface
46
being marked as such. Thus you should always use the Q_INTERFACES macro in classes deriving
47
from QQmlFinalizerHook.
48
*/
49
50
/*!
51
\fn void QQmlFinalizerHook::componentFinalized()
52
53
The customization point provided by this interface. See the class description for
54
why it is useful and how it compares to componentComplete.
55
56
\sa QQmlParserStatus::componentComplete
57
58
*/
59
60
QT_END_NAMESPACE
qtdeclarative
src
qml
qml
qqmlfinalizer.cpp
Generated on
for Qt by
1.16.1