Skip to content

Commit

Permalink
Make setInstance private and QgsConfigCache a friend
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jun 17, 2018
1 parent 65c1ed2 commit 9c85457
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
1 change: 0 additions & 1 deletion python/core/auto_generated/qgsproject.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Most of the time you want to use QgsProject.instance() instead as many component

~QgsProject();


void setTitle( const QString &title );
%Docstring
Sets the project's title.
Expand Down
38 changes: 21 additions & 17 deletions src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,14 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
~QgsProject() override;

/**
* Set the current project 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
* \see instance()
* \since QGIS 3.2
*/
static void setInstance( QgsProject *project ) SIP_SKIP;

/**
* Sets the project's title.
* \param title new title
*
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
*
* \see title()
* \since QGIS 2.4
*/
* Sets the project's title.
* \param title new title
*
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
*
* \see title()
* \since QGIS 2.4
*/
void setTitle( const QString &title );

/**
Expand Down Expand Up @@ -1266,6 +1257,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

static QgsProject *sProject;

/**
* Set the current project 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
* \see instance()
* \note not available in Python bindings
* \since QGIS 3.2
*/
static void setInstance( QgsProject *project ) SIP_SKIP;

/**
* Read map layers from project file.
* \param doc DOM document to parse
Expand Down Expand Up @@ -1371,6 +1372,9 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
QgsProjectMetadata mMetadata;

friend class QgsProjectDirtyBlocker;

// Required by QGIS Server for switching the current project instance
friend class QgsConfigCache;
};

/**
Expand Down
Binary file modified tests/testdata/qgis_server/value_relation.gpkg
Binary file not shown.

0 comments on commit 9c85457

Please sign in to comment.