Skip to content

Commit 9c85457

Browse files
committed
Make setInstance private and QgsConfigCache a friend
1 parent 65c1ed2 commit 9c85457

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

python/core/auto_generated/qgsproject.sip.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Most of the time you want to use QgsProject.instance() instead as many component
4646

4747
~QgsProject();
4848

49-
5049
void setTitle( const QString &title );
5150
%Docstring
5251
Sets the project's title.

src/core/qgsproject.h

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,14 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
110110
~QgsProject() override;
111111

112112
/**
113-
* Set the current project instance to \a project
114-
*
115-
* \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
116-
* \see instance()
117-
* \since QGIS 3.2
118-
*/
119-
static void setInstance( QgsProject *project ) SIP_SKIP;
120-
121-
/**
122-
* Sets the project's title.
123-
* \param title new title
124-
*
125-
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
126-
*
127-
* \see title()
128-
* \since QGIS 2.4
129-
*/
113+
* Sets the project's title.
114+
* \param title new title
115+
*
116+
* \note Since QGIS 3.2 this is just a shortcut to setting the title in the project's metadata().
117+
*
118+
* \see title()
119+
* \since QGIS 2.4
120+
*/
130121
void setTitle( const QString &title );
131122

132123
/**
@@ -1266,6 +1257,16 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
12661257

12671258
static QgsProject *sProject;
12681259

1260+
/**
1261+
* Set the current project instance to \a project
1262+
*
1263+
* \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
1264+
* \see instance()
1265+
* \note not available in Python bindings
1266+
* \since QGIS 3.2
1267+
*/
1268+
static void setInstance( QgsProject *project ) SIP_SKIP;
1269+
12691270
/**
12701271
* Read map layers from project file.
12711272
* \param doc DOM document to parse
@@ -1371,6 +1372,9 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
13711372
QgsProjectMetadata mMetadata;
13721373

13731374
friend class QgsProjectDirtyBlocker;
1375+
1376+
// Required by QGIS Server for switching the current project instance
1377+
friend class QgsConfigCache;
13741378
};
13751379

13761380
/**
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)