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
qqmlparserstatus.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 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
4
#
include
"qqmlparserstatus.h"
5
6
QT_BEGIN_NAMESPACE
7
8
/*!
9
\class QQmlParserStatus
10
\since 5.0
11
\inmodule QtQml
12
\brief The QQmlParserStatus class provides updates on the QML parser state.
13
14
QQmlParserStatus provides a mechanism for classes instantiated by
15
a QQmlEngine to receive notification at key points in their creation.
16
17
This class is often used for optimization purposes, as it allows you to defer an
18
expensive operation until after all the properties have been set on an
19
object. For example, QML's \l {Text} element uses the parser status
20
to defer text layout until all of its properties have been set (we
21
don't want to layout when the \c text is assigned, and then relayout
22
when the \c font is assigned, and relayout again when the \c width is assigned,
23
and so on).
24
25
Be aware that QQmlParserStatus methods are only called when a class is instantiated
26
by a QQmlEngine. If you create the same class directly from C++, these methods will
27
not be called automatically. To avoid this problem, it is recommended that you start
28
deferring operations from classBegin instead of from the initial creation of your class.
29
This will still prevent multiple revaluations during initial binding assignment in QML,
30
but will not defer operations invoked from C++.
31
32
To use QQmlParserStatus, you must inherit both a QObject-derived class
33
and QQmlParserStatus, and use the Q_INTERFACES() macro.
34
35
\snippet code/src_qml_qqmlparserstatus.cpp 0
36
*/
37
38
/*! \internal */
39
QQmlParserStatus::QQmlParserStatus()
40
: d(0)
41
{
42
Q_UNUSED(d);
43
}
44
45
/*! \internal */
46
QQmlParserStatus::~QQmlParserStatus() =
default
;
47
48
/*!
49
\fn void QQmlParserStatus::classBegin()
50
51
Invoked after class creation, but before any properties have been set.
52
*/
53
54
/*!
55
\fn void QQmlParserStatus::componentComplete()
56
57
Invoked after the root component that caused this instantiation has
58
completed construction. At this point all static values and binding values
59
have been assigned to the class.
60
*/
61
62
QT_END_NAMESPACE
qtdeclarative
src
qml
qml
qqmlparserstatus.cpp
Generated on
for Qt by
1.14.0