From: Alan Alpert Date: Fri, 27 Apr 2012 02:09:01 +0000 (+1000) Subject: Mention the common usecase for classBegin in QQmlParserStatus doc X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=15692017d5b94302305bf15cfd1dd34dcc8a3a9e;p=konrad%2Fqtdeclarative.git Mention the common usecase for classBegin in QQmlParserStatus doc Change-Id: I17800a5f03831750432eab2775a47f6146733e92 Reviewed-by: Michael Brasser --- diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp index 8468a1d..b895034 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.