Add a warning about the usage of setInstance

This commit is contained in:
Alessandro Pasotti 2020-09-16 10:33:11 +02:00 committed by Nyall Dawson
parent a782420153
commit cbb0cb3f1c
2 changed files with 9 additions and 4 deletions

View File

@ -71,11 +71,15 @@ Returns the QgsProject singleton instance
static void setInstance( QgsProject *project );
%Docstring
Set the current project instance to ``project``
Set the current project singleton instance to ``project``
.. note::
this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
this method is provided mainly for the server, which caches the projects and (potentially) needs to switch the current instance on every request.
.. warning::
calling this method can have serious, unintended consequences, including instability, data loss and undefined behaviour. Use with EXTREME caution!
.. seealso:: :py:func:`instance`

View File

@ -166,9 +166,10 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
static QgsProject *instance();
/**
* Set the current project instance to \a project
* Set the current project singleton instance to \a project
*
* \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
* \note this method is provided mainly for the server, which caches the projects and (potentially) needs to switch the current instance on every request.
* \warning calling this method can have serious, unintended consequences, including instability, data loss and undefined behaviour. Use with EXTREME caution!
* \see instance()
* \since QGIS 3.10.11
*/