QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Classes | Functions
qgsproject.cpp File Reference
#include "qgsproject.h"
#include "moc_qgsproject.cpp"
#include "qgsdatasourceuri.h"
#include "qgslabelingenginesettings.h"
#include "qgslayertree.h"
#include "qgslayertreeutils.h"
#include "qgslayertreeregistrybridge.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgsmaplayerfactory.h"
#include "qgspluginlayerregistry.h"
#include "qgsprojectfiletransform.h"
#include "qgssnappingconfig.h"
#include "qgspathresolver.h"
#include "qgsprojectstorage.h"
#include "qgsprojectstorageregistry.h"
#include "qgsprojectversion.h"
#include "qgsrasterlayer.h"
#include "qgsreadwritecontext.h"
#include "qgsrelationmanager.h"
#include "qgsannotationmanager.h"
#include "qgsvectorlayerjoinbuffer.h"
#include "qgsmapthemecollection.h"
#include "qgslayerdefinition.h"
#include "qgsunittypes.h"
#include "qgstransaction.h"
#include "qgstransactiongroup.h"
#include "qgsvectordataprovider.h"
#include "qgsprojectbadlayerhandler.h"
#include "qgsmeshlayer.h"
#include "qgslayoutmanager.h"
#include "qgsbookmarkmanager.h"
#include "qgsmaplayerstore.h"
#include "qgsziputils.h"
#include "qgsauxiliarystorage.h"
#include "qgscolorutils.h"
#include "qgsapplication.h"
#include "qgsexpressioncontextutils.h"
#include "qgsstyleentityvisitor.h"
#include "qgsprojectviewsettings.h"
#include "qgsprojectstylesettings.h"
#include "qgsprojecttimesettings.h"
#include "qgsvectortilelayer.h"
#include "qgstiledscenelayer.h"
#include "qgsruntimeprofiler.h"
#include "qgsannotationlayer.h"
#include "qgspointcloudlayer.h"
#include "qgsattributeeditorcontainer.h"
#include "qgsgrouplayer.h"
#include "qgsmapviewsmanager.h"
#include "qgsprojectelevationproperties.h"
#include "qgscombinedstylemodel.h"
#include "qgsprojectgpssettings.h"
#include "qgsthreadingutils.h"
#include "qgssensormanager.h"
#include "qgsproviderregistry.h"
#include "qgsrunnableprovidercreator.h"
#include "qgssettingsregistrycore.h"
#include "qgspluginlayer.h"
#include "qgspythonrunner.h"
#include <algorithm>
#include <QApplication>
#include <QFileInfo>
#include <QDomNode>
#include <QObject>
#include <QTextStream>
#include <QTemporaryFile>
#include <QDir>
#include <QUrl>
#include <QStandardPaths>
#include <QUuid>
#include <QRegularExpression>
#include <QThreadPool>
#include <utime.h>
Include dependency graph for qgsproject.cpp:

Go to the source code of this file.

Classes

struct  LayerToLoad
 

Functions

void _getProperties (const QDomDocument &doc, QgsProjectPropertyKey &project_properties)
 Restores any optional properties found in "doc" to "properties".
 
QgsProjectPropertyaddKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey *rootProperty, const QVariant &value, bool &propertiesModified)
 Adds the given key and value.
 
void dump_ (const QgsProjectPropertyKey &topQgsPropertyKey)
 
QgsProjectPropertyfindKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey &rootProperty)
 Returns the property that matches the given key sequence, if any.
 
QgsPropertyCollection getDataDefinedServerProperties (const QDomDocument &doc, const QgsPropertiesDefinition &dataDefinedServerPropertyDefinitions)
 Returns the data defined server properties collection found in "doc" to "dataDefinedServerProperties".
 
QgsProjectVersion getVersion (const QDomDocument &doc)
 Returns the version string found in the given DOM document.
 
QStringList makeKeyTokens_ (const QString &scope, const QString &key)
 Takes the given scope and key and convert them to a string list of key tokens that will be used to navigate through a Property hierarchy.
 
void removeKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey &rootProperty)
 Removes a given key.
 

Function Documentation

◆ _getProperties()

void _getProperties ( const QDomDocument &  doc,
QgsProjectPropertyKey project_properties 
)

Restores any optional properties found in "doc" to "properties".

properties tags for all optional properties. Within that there will be scope tags. In the following example there exist one property in the "fsplugin" scope. "layers" is a list containing three string values.

<properties>
<fsplugin>
<foo type="int" >42</foo>
<baz type="int" >1</baz>
<layers type="QStringList" >
<value>railroad</value>
<value>airport</value>
</layers>
<xyqzzy type="int" >1</xyqzzy>
<bar type="double" >123.456</bar>
<feature_types type="QStringList" >
<value>type</value>
</feature_types>
</fsplugin>
</properties>
Parameters
docxml document
project_propertiesshould be the top QgsProjectPropertyKey node.

Definition at line 1334 of file qgsproject.cpp.

◆ addKey_()

QgsProjectProperty * addKey_ ( const QString &  scope,
const QString &  key,
QgsProjectPropertyKey rootProperty,
const QVariant &  value,
bool &  propertiesModified 
)

Adds the given key and value.

Parameters
scopescope of key
keykey name
rootPropertyis the property from which to start adding
valuethe value associated with the key
propertiesModifiedthe parameter will be set to true if the written entry modifies pre-existing properties

Definition at line 225 of file qgsproject.cpp.

◆ dump_()

void dump_ ( const QgsProjectPropertyKey topQgsPropertyKey)

Definition at line 1300 of file qgsproject.cpp.

◆ findKey_()

QgsProjectProperty * findKey_ ( const QString &  scope,
const QString &  key,
QgsProjectPropertyKey rootProperty 
)

Returns the property that matches the given key sequence, if any.

Parameters
scopescope of key
keykeyname
rootPropertyis likely to be the top level QgsProjectPropertyKey in QgsProject:e:Imp.
Returns
null if not found, otherwise located Property

Definition at line 148 of file qgsproject.cpp.

◆ getDataDefinedServerProperties()

QgsPropertyCollection getDataDefinedServerProperties ( const QDomDocument &  doc,
const QgsPropertiesDefinition dataDefinedServerPropertyDefinitions 
)

Returns the data defined server properties collection found in "doc" to "dataDefinedServerProperties".

Parameters
docxml document
dataDefinedServerPropertyDefinitionsproperty collection of the server overrides
Since
QGIS 3.14

Definition at line 1363 of file qgsproject.cpp.

◆ getVersion()

QgsProjectVersion getVersion ( QDomDocument const &  doc)

Returns the version string found in the given DOM document.

Returns
the version string or an empty string if none found
Note
not available in Python bindings.

Definition at line 1432 of file qgsproject.cpp.

◆ makeKeyTokens_()

QStringList makeKeyTokens_ ( const QString &  scope,
const QString &  key 
)

Takes the given scope and key and convert them to a string list of key tokens that will be used to navigate through a Property hierarchy.

E.g., scope "someplugin" and key "/foo/bar/baz" will become a string list of { "properties", "someplugin", "foo", "bar", "baz" }. "properties" is always first because that's the permanent `‘root’' Property node.

Definition at line 111 of file qgsproject.cpp.

◆ removeKey_()

void removeKey_ ( const QString &  scope,
const QString &  key,
QgsProjectPropertyKey rootProperty 
)

Removes a given key.

Parameters
scopescope of key
keykey name
rootPropertyis the property from which to start adding

Definition at line 311 of file qgsproject.cpp.