QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Functions
qgsproject.cpp File Reference
#include "qgsproject.h"
#include "qgsdatasourceuri.h"
#include "qgslabelingenginesettings.h"
#include "qgslayertree.h"
#include "qgslayertreeutils.h"
#include "qgslayertreeregistrybridge.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgspluginlayer.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 "qgsrectangle.h"
#include "qgsrelationmanager.h"
#include "qgsannotationmanager.h"
#include "qgsvectorlayerjoininfo.h"
#include "qgsmapthemecollection.h"
#include "qgslayerdefinition.h"
#include "qgsunittypes.h"
#include "qgstransaction.h"
#include "qgstransactiongroup.h"
#include "qgsvectordataprovider.h"
#include "qgsprojectbadlayerhandler.h"
#include "qgssettings.h"
#include "qgsmaplayerlistutils.h"
#include "qgsmeshlayer.h"
#include "qgslayoutmanager.h"
#include "qgsmaplayerstore.h"
#include "qgsziputils.h"
#include "qgsauxiliarystorage.h"
#include <QApplication>
#include <QFileInfo>
#include <QDomNode>
#include <QObject>
#include <QTextStream>
#include <QTemporaryFile>
#include <QDir>
#include <QUrl>
#include <utime.h>
Include dependency graph for qgsproject.cpp:

Go to the source code of this file.

Functions

void _getProperties (const QDomDocument &doc, QgsProjectPropertyKey &project_properties)
 Restore any optional properties found in "doc" to "properties". More...
 
QgsProjectPropertyaddKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey *rootProperty, const QVariant &value, bool &propertiesModified)
 Add the given key and value. More...
 
void dump_ (const QgsProjectPropertyKey &topQgsPropertyKey)
 
QgsProjectPropertyfindKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey &rootProperty)
 return the property that matches the given key sequence, if any More...
 
QgsProjectVersion getVersion (const QDomDocument &doc)
 Returns the version string found in the given DOM document. More...
 
QStringList makeKeyTokens_ (const QString &scope, const QString &key)
 Take 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. More...
 
void removeKey_ (const QString &scope, const QString &key, QgsProjectPropertyKey &rootProperty)
 Remove a given key. More...
 

Function Documentation

void _getProperties ( const QDomDocument &  doc,
QgsProjectPropertyKey project_properties 
)

Restore 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.

1 <properties>
2  <fsplugin>
3  <foo type="int" >42</foo>
4  <baz type="int" >1</baz>
5  <layers type="QStringList" >
6  <value>railroad</value>
7  <value>airport</value>
8  </layers>
9  <xyqzzy type="int" >1</xyqzzy>
10  <bar type="double" >123.456</bar>
11  <feature_types type="QStringList" >
12  <value>type</value>
13  </feature_types>
14  </fsplugin>
15 </properties>
Parameters
docxml document
project_propertiesshould be the top QgsProjectPropertyKey node.

Definition at line 758 of file qgsproject.cpp.

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

Add 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 202 of file qgsproject.cpp.

void dump_ ( const QgsProjectPropertyKey topQgsPropertyKey)

Definition at line 721 of file qgsproject.cpp.

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

return 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 125 of file qgsproject.cpp.

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 820 of file qgsproject.cpp.

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

Take 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 83 of file qgsproject.cpp.

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

Remove a given key.

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

Definition at line 289 of file qgsproject.cpp.