From 15692017d5b94302305bf15cfd1dd34dcc8a3a9e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 27 Apr 2012 12:09:01 +1000 Subject: Mention the common usecase for classBegin in QQmlParserStatus doc Change-Id: I17800a5f03831750432eab2775a47f6146733e92 Reviewed-by: Michael Brasser --- src/qml/qml/qqmlparserstatus.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp index 8468a1da00..b895034046 100644 --- a/src/qml/qml/qqmlparserstatus.cpp +++ b/src/qml/qml/qqmlparserstatus.cpp @@ -60,6 +60,13 @@ QT_BEGIN_NAMESPACE when the \c font is assigned, and relayout again when the \c width is assigned, and so on). + Be aware that QQmlParserStatus methods are only called when a class is instantiated + by a QQmlEngine. If you create the same class directly from C++, these methods will + not be called automatically. To avoid this problem, it is recommended that you start + deferring operations from classBegin instead of from the initial creation of your class. + This will still prevent multiple revaluations during initial binding assignment in QML, + but will not defer operations invoked from C++. + To use QQmlParserStatus, you must inherit both a QObject-derived class and QQmlParserStatus, and use the Q_INTERFACES() macro. -- cgit v1.2.3