From c71e8aadec7394cbf54fc6d79c3a7076c0c41a48 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 20 Oct 2015 15:58:42 +0200 Subject: Document default argument behavior of Qt.createComponent() It's not currently clear how to get the default mode when also passing a parent, though lots of Qt code simply omits the argument. Change-Id: I35db7cf57991a2a3fafe4d00df2879b98037e93c Reviewed-by: Andy Shaw --- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/v8') diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index ca488021c8..f4e980eefb 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1074,10 +1074,23 @@ If the optional \a mode parameter is set to \c Component.Asynchronous, the component will be loaded in a background thread. The Component::status property will be \c Component.Loading while it is loading. The status will change to \c Component.Ready if the component loads successfully, or \c Component.Error -if loading fails. +if loading fails. This parameter defaults to \c Component.PreferSynchronous +if omitted. + +If \a mode is set to \c Component.PreferSynchronous, Qt will attempt to load +the component synchronously, but may end up loading it asynchronously if +necessary. Scenarios that may cause asynchronous loading include, but are not +limited to, the following: + +\list +\li The URL refers to a network resource +\li The component is being created as a result of another component that is +being loaded asynchronously +\endlist If the optional \a parent parameter is given, it should refer to the object -that will become the parent for the created \l Component object. +that will become the parent for the created \l Component object. If no mode +was passed, this can be the second argument. Call \l {Component::createObject()}{Component.createObject()} on the returned component to create an object instance of the component. -- cgit v1.2.3