QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsproject.cpp File Reference
#include "qgsproject.h"
#include <algorithm>
#include "qgsannotationlayer.h"
#include "qgsannotationmanager.h"
#include "qgsapplication.h"
#include "qgsattributeeditorcontainer.h"
#include "qgsauxiliarystorage.h"
#include "qgsbookmarkmanager.h"
#include "qgscolorutils.h"
#include "qgscombinedstylemodel.h"
#include "qgsdatasourceuri.h"
#include "qgselevationprofilemanager.h"
#include "qgsexpressioncontextutils.h"
#include "qgsgrouplayer.h"
#include "qgslabelingenginesettings.h"
#include "qgslayerdefinition.h"
#include "qgslayertree.h"
#include "qgslayertreeregistrybridge.h"
#include "qgslayertreeutils.h"
#include "qgslayoutmanager.h"
#include "qgslogger.h"
#include "qgsmaplayerfactory.h"
#include "qgsmaplayerstore.h"
#include "qgsmapthemecollection.h"
#include "qgsmapviewsmanager.h"
#include "qgsmeshlayer.h"
#include "qgsmessagelog.h"
#include "qgsobjectvisitor.h"
#include "qgspathresolver.h"
#include "qgspluginlayer.h"
#include "qgspluginlayerregistry.h"
#include "qgspointcloudlayer.h"
#include "qgsprojectbadlayerhandler.h"
#include "qgsprojectelevationproperties.h"
#include "qgsprojectfiletransform.h"
#include "qgsprojectgpssettings.h"
#include "qgsprojectstorage.h"
#include "qgsprojectstorageregistry.h"
#include "qgsprojectstylesettings.h"
#include "qgsprojecttimesettings.h"
#include "qgsprojectutils.h"
#include "qgsprojectversion.h"
#include "qgsprojectviewsettings.h"
#include "qgsproviderregistry.h"
#include "qgspythonrunner.h"
#include "qgsrasterlayer.h"
#include "qgsreadwritecontext.h"
#include "qgsrelationmanager.h"
#include "qgsrunnableprovidercreator.h"
#include "qgsruntimeprofiler.h"
#include "qgssensormanager.h"
#include "qgssettingsregistrycore.h"
#include "qgssnappingconfig.h"
#include "qgsstyleentityvisitor.h"
#include "qgsthreadingutils.h"
#include "qgstiledscenelayer.h"
#include "qgstransaction.h"
#include "qgstransactiongroup.h"
#include "qgsunittypes.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayerjoinbuffer.h"
#include "qgsvectortilelayer.h"
#include "qgsziputils.h"
#include <QApplication>
#include <QDir>
#include <QDomNode>
#include <QFileInfo>
#include <QObject>
#include <QRegularExpression>
#include <QStandardPaths>
#include <QTemporaryFile>
#include <QTextStream>
#include <QThreadPool>
#include <QUrl>
#include <QUuid>
#include "moc_qgsproject.cpp"
#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)
 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.
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.
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 name="properties">
<properties name="fsplugin">
<properties name="foo" type="int" >42</properties>
<properties name="baz" type="int" >1</properties>
<properties name="layers" type="QStringList">
<value>railroad</value>
<value>airport</value>
</properties>
<properties name="xyqzzy" type="int" >1</properties>
<properties name="bar" type="double" >123.456</properties>
<properties name="feature_types" type="QStringList">
<value>type</value>
</properties>
</properties>
</properties>
Parameters
docxml document
project_propertiesshould be the top QgsProjectPropertyKey node.

Definition at line 1360 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 215 of file qgsproject.cpp.

◆ dump_()

void dump_ ( const QgsProjectPropertyKey & topQgsPropertyKey)

Definition at line 1326 of file qgsproject.cpp.

◆ findKey_()

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

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. */ QStringList makeKeyTokens_( const QString &scope, const QString &key ) { QStringList keyTokens = QStringList( scope ); keyTokens += key.split( '/', Qt::SkipEmptyParts );

be sure to include the canonical root node keyTokens.push_front( QStringLiteral( "properties" ) );

return keyTokens; }

/** 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 138 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 1389 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 1458 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 301 of file qgsproject.cpp.