QGIS/python/core/auto_generated/qgsproject.sip.in

1480 lines
38 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsproject.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsProject : QObject, QgsExpressionContextGenerator, QgsProjectTranslator
{
%Docstring
Reads and writes project states.
\note
Has two general kinds of state to make persistent. (I.e., to read and
write.) First, QGIS proprietary information. Second plug-in information.
A singleton since there shall only be one active project at a time; and
provides canonical location for plug-ins and main app to find/set
properties.
%End
%TypeHeaderCode
#include "qgsproject.h"
%End
public:
static QgsProject *instance();
%Docstring
Returns the QgsProject singleton instance
%End
explicit QgsProject( QObject *parent /TransferThis/ = 0 );
%Docstring
Create a new QgsProject.
Most of the time you want to use QgsProject.instance() instead as many components of QGIS work with the singleton.
%End
~QgsProject();
void setTitle( const QString &title );
%Docstring
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().
.. seealso:: :py:func:`title`
.. versionadded:: 2.4
%End
QString title() const;
%Docstring
Returns the project's title.
.. seealso:: :py:func:`setTitle`
.. note::
Since QGIS 3.2 this is just a shortcut to retrieving the title from the project's metadata().
%End
bool isDirty() const;
%Docstring
Returns true if the project has been modified since the last write()
%End
void setFileName( const QString &name );
%Docstring
Sets the file name associated with the project. This is the file which contains the project's XML
representation.
:param name: project file name
.. seealso:: :py:func:`fileName`
%End
QString fileName() const;
%Docstring
Returns the project's file name. This is the file which contains the project's XML
representation.
.. seealso:: :py:func:`setFileName`
.. seealso:: :py:func:`fileInfo`
%End
QFileInfo fileInfo() const /Deprecated/;
%Docstring
Returns QFileInfo object for the project's associated file.
.. note::
The use of this method is discouraged since QGIS 3.2 as it only works with project files stored
in the file system. It is recommended to use absoluteFilePath(), baseName(), lastModifiedTime() as
replacements that are aware of the fact that projects may be saved in other project storages.
.. seealso:: :py:func:`fileName`
.. versionadded:: 2.9
.. deprecated:: Use absoluteFilePath(), baseName() or lastModifiedTime() instead
%End
QgsProjectStorage *projectStorage() const;
%Docstring
Returns pointer to project storage implementation that handles read/write of the project file.
If the project file is stored in the local file system, returns null pointer.
The project storage object is inferred from fileName() of the project.
.. versionadded:: 3.2
%End
QDateTime lastModified() const;
%Docstring
Returns last modified time of the project file as returned by the file system (or other project storage).
.. versionadded:: 3.2
%End
QString absoluteFilePath() const;
%Docstring
Returns full absolute path to the project file if the project is stored in a file system - derived from fileName().
Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages).
.. versionadded:: 3.2
%End
QString absolutePath() const;
%Docstring
Returns full absolute path to the project folder if the project is stored in a file system - derived from fileName().
Returns empty string when the project is stored in a project storage (there is no concept of paths for custom project storages).
.. versionadded:: 3.2
%End
QString baseName() const;
%Docstring
Returns the base name of the project file without the path and without extension - derived from fileName().
.. versionadded:: 3.2
%End
QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the project's native coordinate reference system.
.. seealso:: :py:func:`setCrs`
.. seealso:: :py:func:`ellipsoid`
.. versionadded:: 3.0
%End
void setCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets the project's native coordinate reference system.
.. seealso:: :py:func:`crs`
.. seealso:: :py:func:`setEllipsoid`
.. versionadded:: 3.0
%End
QString ellipsoid() const;
%Docstring
Returns a proj string representing the project's ellipsoid setting, e.g., "WGS84".
.. seealso:: :py:func:`setEllipsoid`
.. seealso:: :py:func:`crs`
.. versionadded:: 3.0
%End
void setEllipsoid( const QString &ellipsoid );
%Docstring
Sets the project's ellipsoid from a proj string representation, e.g., "WGS84".
.. seealso:: :py:func:`ellipsoid`
.. seealso:: :py:func:`setCrs`
.. versionadded:: 3.0
%End
QgsCoordinateTransformContext transformContext() const;
%Docstring
Returns a copy of the project's coordinate transform context, which stores various
information regarding which datum transforms should be used when transforming points
from a source to destination coordinate reference system.
.. seealso:: :py:func:`setTransformContext`
.. seealso:: :py:func:`transformContextChanged`
.. versionadded:: 3.0
%End
void setTransformContext( const QgsCoordinateTransformContext &context );
%Docstring
Sets the project's coordinate transform ``context``, which stores various
information regarding which datum transforms should be used when transforming points
from a source to destination coordinate reference system.
.. seealso:: :py:func:`transformContext`
.. seealso:: :py:func:`transformContextChanged`
.. versionadded:: 3.0
%End
void clear();
%Docstring
Clears the project, removing all settings and resetting it back to an empty, default state.
.. seealso:: :py:func:`cleared`
.. versionadded:: 2.4
%End
bool read( const QString &filename );
%Docstring
Reads given project file from the given file.
:param filename: name of project file to read
:return: true if project file has been read successfully
%End
bool read();
%Docstring
Reads the project from its currently associated file (see fileName() ).
:return: true if project file has been read successfully
%End
bool readLayer( const QDomNode &layerNode );
%Docstring
Reads the layer described in the associated DOM node.
.. note::
This method is mainly for use by QgsProjectBadLayerHandler subclasses
that may fix definition of bad layers with the user's help in GUI. Calling
this method with corrected DOM node adds the layer back to the project.
:param layerNode: represents a QgsProject DOM node that encodes a specific layer.
%End
bool write( const QString &filename );
%Docstring
Writes the project to a file.
:param filename: destination file
:return: true if project was written successfully
.. note::
calling this implicitly sets the project's filename (see setFileName() )
.. note::
isDirty() will be set to false if project is successfully written
.. versionadded:: 3.0
%End
bool write();
%Docstring
Writes the project to its current associated file (see fileName() ).
:return: true if project was written successfully
.. note::
isDirty() will be set to false if project is successfully written
%End
bool writeEntry( const QString &scope, const QString &key, bool value ) /PyName=writeEntryBool/;
%Docstring
Write a boolean entry to the project file.
Keys are '/'-delimited entries, implying
a hierarchy of keys and corresponding values
.. note::
The key string must be valid xml tag names in order to be saved to the file.
.. note::
available in Python bindings as writeEntryBool
%End
bool writeEntry( const QString &scope, const QString &key, double value ) /PyName=writeEntryDouble/;
%Docstring
Write a double entry to the project file.
Keys are '/'-delimited entries, implying
a hierarchy of keys and corresponding values
.. note::
The key string must be valid xml tag names in order to be saved to the file.
.. note::
available in Python bindings as writeEntryDouble
%End
bool writeEntry( const QString &scope, const QString &key, int value );
%Docstring
Write an integer entry to the project file.
Keys are '/'-delimited entries, implying
a hierarchy of keys and corresponding values
.. note::
The key string must be valid xml tag names in order to be saved to the file.
%End
bool writeEntry( const QString &scope, const QString &key, const QString &value );
%Docstring
Write a string entry to the project file.
Keys are '/'-delimited entries, implying
a hierarchy of keys and corresponding values
.. note::
The key string must be valid xml tag names in order to be saved to the file.
%End
bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
%Docstring
Write a string list entry to the project file.
Keys are '/'-delimited entries, implying
a hierarchy of keys and corresponding values
.. note::
The key string must be valid xml tag names in order to be saved to the file.
%End
QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(), bool *ok = 0 ) const;
%Docstring
Key value accessors
keys would be the familiar QgsSettings-like '/' delimited entries,
implying a hierarchy of keys and corresponding values
%End
QString readEntry( const QString &scope, const QString &key, const QString &def = QString(), bool *ok = 0 ) const;
int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = 0 ) const;
double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = 0 ) const;
bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = 0 ) const;
bool removeEntry( const QString &scope, const QString &key );
%Docstring
Remove the given key
%End
QStringList entryList( const QString &scope, const QString &key ) const;
%Docstring
Returns keys with values -- do not return keys that contain other keys
.. note::
equivalent to QgsSettings entryList()
%End
QStringList subkeyList( const QString &scope, const QString &key ) const;
%Docstring
Returns keys with keys -- do not return keys that contain only values
.. note::
equivalent to QgsSettings subkeyList()
%End
void dumpProperties() const;
QgsPathResolver pathResolver() const;
%Docstring
Returns path resolver object with considering whether the project uses absolute
or relative paths and using current project's path.
.. versionadded:: 3.0
%End
QString writePath( const QString &filename ) const;
%Docstring
Prepare a filename to save it to the project file.
Creates an absolute or relative path according to the project settings.
Paths written to the project file should be prepared with this method.
%End
QString readPath( const QString &filename ) const;
%Docstring
Turn filename read from the project file to an absolute path
%End
QString error() const;
%Docstring
Returns error message from previous read/write
%End
void setBadLayerHandler( QgsProjectBadLayerHandler *handler /Transfer/ );
%Docstring
Change handler for missing layers.
Deletes old handler and takes ownership of the new one.
%End
QString layerIsEmbedded( const QString &id ) const;
%Docstring
Returns project file path if layer is embedded from other project file. Returns empty string if layer is not embedded
%End
QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers );
%Docstring
Create layer group instance defined in an arbitrary project file.
.. versionadded:: 2.4
%End
void setTopologicalEditing( bool enabled );
%Docstring
Convenience function to set topological editing
%End
bool topologicalEditing() const;
%Docstring
Convenience function to query topological editing status
%End
QgsUnitTypes::DistanceUnit distanceUnits() const;
%Docstring
Convenience function to query default distance measurement units for project.
.. seealso:: :py:func:`setDistanceUnits`
.. seealso:: :py:func:`areaUnits`
.. versionadded:: 2.14
%End
void setDistanceUnits( QgsUnitTypes::DistanceUnit unit );
%Docstring
Sets the default distance measurement units for the project.
.. seealso:: :py:func:`distanceUnits`
.. seealso:: :py:func:`setAreaUnits`
.. versionadded:: 3.0
%End
QgsUnitTypes::AreaUnit areaUnits() const;
%Docstring
Convenience function to query default area measurement units for project.
.. seealso:: :py:func:`distanceUnits`
.. versionadded:: 2.14
%End
void setAreaUnits( QgsUnitTypes::AreaUnit unit );
%Docstring
Sets the default area measurement units for the project.
.. seealso:: :py:func:`areaUnits`
.. seealso:: :py:func:`setDistanceUnits`
.. versionadded:: 3.0
%End
QString homePath() const;
%Docstring
Returns the project's home path. This will either be a manually set home path
(see presetHomePath()) or the path containing the project file itself.
This method always returns the absolute path to the project's home. See
presetHomePath() to retrieve any manual project home path override (e.g.
relative home paths).
.. seealso:: :py:func:`setPresetHomePath`
.. seealso:: :py:func:`presetHomePath`
.. seealso:: :py:func:`homePathChanged`
%End
QString presetHomePath() const;
%Docstring
Returns any manual project home path setting, or an empty string if not set.
This path may be a relative path. See homePath() to retrieve a path which is always
an absolute path.
.. seealso:: :py:func:`homePath`
.. seealso:: :py:func:`setPresetHomePath`
.. seealso:: :py:func:`homePathChanged`
.. versionadded:: 3.2
%End
QgsRelationManager *relationManager() const;
QgsLayoutManager *layoutManager();
%Docstring
Returns the project's layout manager, which manages compositions within
the project.
.. versionadded:: 3.0
%End
QgsLayerTree *layerTreeRoot() const;
%Docstring
Returns pointer to the root (invisible) node of the project's layer tree
.. versionadded:: 2.4
%End
QgsLayerTreeRegistryBridge *layerTreeRegistryBridge() const;
%Docstring
Returns pointer to the helper class that synchronizes map layer registry with layer tree
.. versionadded:: 2.4
%End
QgsMapThemeCollection *mapThemeCollection();
%Docstring
Returns pointer to the project's map theme collection.
.. note::
renamed in QGIS 3.0, formerly :py:class:`QgsVisibilityPresetCollection`
.. versionadded:: 2.12
%End
QgsAnnotationManager *annotationManager();
%Docstring
Returns pointer to the project's annotation manager.
.. versionadded:: 3.0
%End
void setNonIdentifiableLayers( const QList<QgsMapLayer *> &layers );
%Docstring
Set a list of layers which should not be taken into account on map identification
.. deprecated:: since QGIS 3.4 use QgsMapLayer.setFlags() instead
%End
void setNonIdentifiableLayers( const QStringList &layerIds );
%Docstring
Set a list of layers which should not be taken into account on map identification
.. deprecated:: since QGIS 3.4 use QgsMapLayer.setFlags() instead
%End
QStringList nonIdentifiableLayers() const;
%Docstring
Gets the list of layers which currently should not be taken into account on map identification
.. deprecated:: since QGIS 3.4 use QgsMapLayer.setFlags() instead
%End
bool autoTransaction() const;
%Docstring
Transactional editing means that on supported datasources (postgres databases) the edit state of
all tables that originate from the same database are synchronized and executed in a server side
transaction.
.. versionadded:: 2.16
%End
void setAutoTransaction( bool autoTransaction );
%Docstring
Transactional editing means that on supported datasources (postgres databases) the edit state of
all tables that originate from the same database are synchronized and executed in a server side
transaction.
Make sure that this is only called when all layers are not in edit mode.
.. versionadded:: 2.16
%End
QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
%Docstring
Returns the matching transaction group from a provider key and connection string.
Returns None if a matching transaction group is not available.
.. versionadded:: 3.2
%End
bool evaluateDefaultValues() const;
%Docstring
Should default values be evaluated on provider side when requested and not when committed.
.. versionadded:: 2.16
%End
void setEvaluateDefaultValues( bool evaluateDefaultValues );
%Docstring
Defines if default values should be evaluated on provider side when requested and not when committed.
.. versionadded:: 2.16
%End
virtual QgsExpressionContext createExpressionContext() const;
QgsSnappingConfig snappingConfig() const;
%Docstring
The snapping configuration for this project.
.. versionadded:: 3.0
%End
QList<QgsVectorLayer *> avoidIntersectionsLayers() const;
%Docstring
A list of layers with which intersections should be avoided.
.. versionadded:: 3.0
%End
void setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &layers );
%Docstring
A list of layers with which intersections should be avoided.
.. versionadded:: 3.0
%End
QVariantMap customVariables() const;
%Docstring
A map of custom project variables.
To get all available variables including generated ones
use QgsExpressionContextUtils.projectScope() instead.
%End
void setCustomVariables( const QVariantMap &customVariables );
%Docstring
A map of custom project variables.
Be careful not to set generated variables.
%End
void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
%Docstring
Sets project's global labeling engine settings
.. versionadded:: 3.0
%End
const QgsLabelingEngineSettings &labelingEngineSettings() const;
%Docstring
Returns project's global labeling engine settings
.. versionadded:: 3.0
%End
QgsMapLayerStore *layerStore();
%Docstring
Returns a pointer to the project's internal layer store.
/since QGIS 3.0
%End
int count() const;
%Docstring
Returns the number of registered layers.
%End
int validCount() const;
%Docstring
Returns the number of registered valid layers.
%End
QgsMapLayer *mapLayer( const QString &layerId ) const;
%Docstring
Retrieve a pointer to a registered layer by layer ID.
:param layerId: ID of layer to retrieve
:return: matching layer, or None if no matching layer found
.. seealso:: :py:func:`mapLayersByName`
.. seealso:: :py:func:`mapLayers`
%End
QList<QgsMapLayer *> mapLayersByName( const QString &layerName ) const;
%Docstring
Retrieve a list of matching registered layers by layer name.
:param layerName: name of layers to match
:return: list of matching layers
.. seealso:: :py:func:`mapLayer`
.. seealso:: :py:func:`mapLayers`
%End
QMap<QString, QgsMapLayer *> mapLayers( const bool validOnly = false ) const;
%Docstring
Returns a map of all registered layers by layer ID.
:param validOnly: if set only valid layers will be returned
.. seealso:: :py:func:`mapLayer`
.. seealso:: :py:func:`mapLayersByName`
.. seealso:: :py:func:`layers`
%End
bool isZipped() const;
%Docstring
Returns true if the project comes from a zip archive, false otherwise.
%End
QList<QgsMapLayer *> addMapLayers( const QList<QgsMapLayer *> &mapLayers /Transfer/,
bool addToLegend = true);
%Docstring
Add a list of layers to the map of loaded layers.
The layersAdded() and layerWasAdded() signals will always be emitted.
The legendLayersAdded() signal is emitted only if addToLegend is true.
:param mapLayers: A list of layer which should be added to the registry
:param addToLegend: If true (by default), the layers will be added to the
legend and to the main canvas. If you have a private
layer you can set this parameter to false to hide it.
:return: a list of the map layers that were added
successfully. If a layer or already exists in the registry,
it will not be part of the returned QList.
.. note::
As a side-effect QgsProject is made dirty.
.. note::
takeOwnership is not available in the Python bindings - the registry will always
take ownership
.. seealso:: :py:func:`addMapLayer`
.. versionadded:: 1.8
%End
QgsMapLayer *addMapLayer( QgsMapLayer *mapLayer /Transfer/,
bool addToLegend = true);
%Docstring
Add a layer to the map of loaded layers.
The layersAdded() and layerWasAdded() signals will always be emitted.
The legendLayersAdded() signal is emitted only if addToLegend is true.
If you are adding multiple layers at once, you should use
addMapLayers() instead.
:param mapLayer: A layer to add to the registry
:param addToLegend: If true (by default), the layer will be added to the
legend and to the main canvas. If you have a private
layer you can set this parameter to false to hide it.
:return: None if unable to add layer, otherwise pointer to newly added layer
.. seealso:: :py:func:`addMapLayers`
.. note::
As a side-effect QgsProject is made dirty.
.. note::
Use addMapLayers if adding more than one layer at a time
.. note::
takeOwnership is not available in the Python bindings - the registry will always
take ownership
.. seealso:: :py:func:`addMapLayers`
%End
void removeMapLayers( const QStringList &layerIds );
%Docstring
Remove a set of layers from the registry by layer ID.
The specified layers will be removed from the registry. If the registry has ownership
of any layers these layers will also be deleted.
:param layerIds: list of IDs of the layers to remove
.. note::
As a side-effect the QgsProject instance is marked dirty.
.. seealso:: :py:func:`removeMapLayer`
.. seealso:: :py:func:`removeAllMapLayers`
.. versionadded:: 1.8
%End
void removeMapLayers( const QList<QgsMapLayer *> &layers );
void removeMapLayer( const QString &layerId );
%Docstring
Remove a layer from the registry by layer ID.
The specified layer will be removed from the registry. If the registry has ownership
of the layer then it will also be deleted.
:param layerId: ID of the layer to remove
.. note::
As a side-effect the QgsProject instance is marked dirty.
.. seealso:: :py:func:`removeMapLayers`
.. seealso:: :py:func:`removeAllMapLayers`
%End
void removeMapLayer( QgsMapLayer *layer );
%Docstring
Remove a layer from the registry.
The specified layer will be removed from the registry. If the registry has ownership
of the layer then it will also be deleted.
:param layer: The layer to remove. Null pointers are ignored.
.. note::
As a side-effect the QgsProject instance is marked dirty.
.. seealso:: :py:func:`removeMapLayers`
.. seealso:: :py:func:`removeAllMapLayers`
%End
QgsMapLayer *takeMapLayer( QgsMapLayer *layer ) /TransferBack/;
%Docstring
Takes a layer from the registry. If the layer was owned by the project, the
layer will be returned without deleting it. The caller takes ownership of
the layer and is responsible for deleting it.
.. seealso:: :py:func:`removeMapLayer`
.. versionadded:: 3.0
%End
void removeAllMapLayers();
%Docstring
Removes all registered layers. If the registry has ownership
of any layers these layers will also be deleted.
.. note::
As a side-effect the QgsProject instance is marked dirty.
.. note::
Calling this method will cause the removeAll() signal to
be emitted.
.. seealso:: :py:func:`removeMapLayer`
.. seealso:: :py:func:`removeMapLayers`
%End
void reloadAllLayers();
%Docstring
Reload all registered layer's provider data caches, synchronising the layer
with any changes in the datasource.
.. seealso:: :py:func:`QgsMapLayer.reload`
%End
QgsCoordinateReferenceSystem defaultCrsForNewLayers() const;
%Docstring
Returns the default CRS for new layers based on the settings and
the current project CRS
%End
void setTrustLayerMetadata( bool trust );
%Docstring
Sets the trust option allowing to indicate if the extent has to be
read from the XML document when data source has no metadata or if the
data provider has to determine it. Moreover, when this option is
activated, primary key unicity is not checked for views and
materialized views with Postgres provider.
:param trust: True to trust the project, false otherwise
.. versionadded:: 3.0
%End
bool trustLayerMetadata() const;
%Docstring
Returns true if the trust option is activated, false otherwise. This
option allows indicateing if the extent has to be read from the XML
document when data source has no metadata or if the data provider has
to determine it. Moreover, when this option is activated, primary key
unicity is not checked for views and materialized views with Postgres
provider.
.. versionadded:: 3.0
%End
QgsAuxiliaryStorage *auxiliaryStorage();
%Docstring
Returns the current auxiliary storage.
.. versionadded:: 3.0
%End
const QgsProjectMetadata &metadata() const;
%Docstring
Returns a reference to the project's metadata store.
.. seealso:: :py:func:`setMetadata`
.. seealso:: :py:func:`metadataChanged`
.. versionadded:: 3.2
%End
void setMetadata( const QgsProjectMetadata &metadata );
%Docstring
Sets the project's ``metadata`` store.
.. seealso:: :py:func:`metadata`
.. seealso:: :py:func:`metadataChanged`
.. versionadded:: 3.2
%End
QSet<QgsMapLayer *> requiredLayers() const;
%Docstring
Returns a set of map layers that are required in the project and therefore they should not get
removed from the project. The set of layers may be configured by users in project properties.
and it is mainly a hint for the user interface to protect users from removing layers that important
in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here.
.. deprecated:: since QGIS 3.4 use QgsMapLayer.flags() instead
.. versionadded:: 3.2
%End
void setRequiredLayers( const QSet<QgsMapLayer *> &layers );
%Docstring
Configures a set of map layers that are required in the project and therefore they should not get
removed from the project. The set of layers may be configured by users in project properties.
and it is mainly a hint for the user interface to protect users from removing layers that important
in the project. The removeMapLayer(), removeMapLayers() calls do not block removal of layers listed here.
.. deprecated:: since QGIS 3.4 use QgsMapLayer.setFlags() instead
.. versionadded:: 3.2
%End
void setProjectColors( const QgsNamedColorList &colors );
%Docstring
Sets the ``colors`` for the project's color scheme (see QgsProjectColorScheme).
.. seealso:: :py:func:`projectColorsChanged`
.. versionadded:: 3.6
%End
void generateTsFile( const QString &locale );
%Docstring
Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile()
.. versionadded:: 3.4
%End
virtual QString translate( const QString &context, const QString &sourceText, const char *disambiguation = 0, int n = -1 ) const;
%Docstring
Translates the project with QTranslator and qm file
:return: the result string (in case there is no QTranslator loaded the sourceText)
:param context: describing layer etc.
:param sourceText: is the identifier of this text
:param disambiguation: it's the disambiguation
:param n: if -1 uses the appropriate form
.. versionadded:: 3.4
%End
signals:
void cleared();
%Docstring
Emitted when the project is cleared (and additionally when an open project is cleared
just before a new project is read).
.. seealso:: :py:func:`clear`
.. versionadded:: 3.2
%End
void readProject( const QDomDocument & );
%Docstring
Emitted when a project is being read.
%End
void readProjectWithContext( const QDomDocument &, QgsReadWriteContext &context );
%Docstring
Emitted when a project is being read. And passing the /a context
%End
void writeProject( QDomDocument & );
%Docstring
Emitted when the project is being written.
%End
void readMapLayer( QgsMapLayer *mapLayer, const QDomElement &layerNode );
%Docstring
Emitted after the basic initialization of a layer from the project
file is done. You can use this signal to read additional information
from the project file.
:param mapLayer: The map layer which is being initialized
:param layerNode: The layer node from the project file
%End
void writeMapLayer( QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
%Docstring
Emitted when a layer is being saved. You can use this method to save
additional information to the layer.
:param mapLayer: The map layer which is being initialized
:param layerElem: The layer element from the project file
:param doc: The document
%End
void projectSaved();
%Docstring
Emitted when the project file has been written and closed.
%End
void oldProjectVersionWarning( const QString & );
%Docstring
Emitted when an old project file is read.
%End
void layerLoaded( int i, int n );
%Docstring
Emitted when a layer from a projects was read.
:param i: current layer
:param n: number of layers
%End
void loadingLayer( const QString &layerName );
%Docstring
Emitted when a layer is loaded
%End
void loadingLayerMessageReceived( const QString &layerName, const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
%Docstring
Emitted when loading layers has produced some messages
:param layerName: the layer name
:param messages: a list of pairs of Qgis.MessageLevel and messages
.. versionadded:: 3.2
%End
void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
%Docstring
Emitted when the list of layer which are excluded from map identification changes
.. deprecated:: since QGIS 3.4
%End
void fileNameChanged();
%Docstring
Emitted when the file name of the project changes
%End
void homePathChanged();
%Docstring
Emitted when the home path of the project changes.
.. seealso:: :py:func:`setPresetHomePath`
.. seealso:: :py:func:`homePath`
.. seealso:: :py:func:`presetHomePath`
%End
void snappingConfigChanged( const QgsSnappingConfig &config );
%Docstring
Emitted whenever the configuration for snapping has changed.
%End
void customVariablesChanged();
%Docstring
Emitted whenever the expression variables stored in the project have been changed.
.. versionadded:: 3.0
%End
void crsChanged();
%Docstring
Emitted when the CRS of the project has changed.
.. versionadded:: 3.0
%End
void ellipsoidChanged( const QString &ellipsoid );
%Docstring
Emitted when the project ``ellipsoid`` is changed.
.. seealso:: :py:func:`setEllipsoid`
.. seealso:: :py:func:`ellipsoid`
.. versionadded:: 3.0
%End
void transformContextChanged();
%Docstring
Emitted when the project transformContext() is changed.
.. seealso:: :py:func:`transformContext`
.. versionadded:: 3.0
%End
void missingDatumTransforms( const QStringList &missingTransforms );
%Docstring
Emitted when datum transforms stored in the project are not available locally.
.. versionadded:: 3.0
%End
void transactionGroupsChanged();
%Docstring
Emitted whenever a new transaction group has been created or a
transaction group has been removed.
.. versionadded:: 3.0
%End
void topologicalEditingChanged();
%Docstring
Emitted when the topological editing flag has changed.
.. versionadded:: 3.0
%End
void avoidIntersectionsLayersChanged();
%Docstring
Emitted whenever avoidIntersectionsLayers has changed.
.. versionadded:: 3.0
%End
void mapThemeCollectionChanged();
%Docstring
Emitted when the map theme collection changes.
This only happens when the map theme collection is reset.
Any pointer previously received from mapThemeCollection()
must no longer be used after this signal is emitted.
You must still connect to signals from the map theme collection
if you want to be notified about new map themes being added and
map themes being removed.
.. versionadded:: 3.0
%End
void labelingEngineSettingsChanged();
%Docstring
Emitted when global configuration of the labeling engine changes.
.. versionadded:: 3.0
%End
void metadataChanged();
%Docstring
Emitted when the project's metadata is changed.
.. seealso:: :py:func:`setMetadata`
.. seealso:: :py:func:`metadata`
.. versionadded:: 3.2
%End
void projectColorsChanged();
%Docstring
Emitted whenever the project's color scheme has been changed.
.. seealso:: :py:func:`setProjectColors`
.. versionadded:: 3.6
%End
void layersWillBeRemoved( const QStringList &layerIds );
%Docstring
Emitted when one or more layers are about to be removed from the registry.
:param layerIds: A list of IDs for the layers which are to be removed.
.. seealso:: :py:func:`layerWillBeRemoved`
.. seealso:: :py:func:`layersRemoved`
%End
void layersWillBeRemoved( const QList<QgsMapLayer *> &layers );
%Docstring
Emitted when one or more layers are about to be removed from the registry.
:param layers: A list of layers which are to be removed.
.. seealso:: :py:func:`layerWillBeRemoved`
.. seealso:: :py:func:`layersRemoved`
%End
void layerWillBeRemoved( const QString &layerId );
%Docstring
Emitted when a layer is about to be removed from the registry.
:param layerId: The ID of the layer to be removed.
.. note::
Consider using layersWillBeRemoved() instead
.. seealso:: :py:func:`layersWillBeRemoved`
.. seealso:: :py:func:`layerRemoved`
%End
void layerWillBeRemoved( QgsMapLayer *layer );
%Docstring
Emitted when a layer is about to be removed from the registry.
:param layer: The layer to be removed.
.. note::
Consider using layersWillBeRemoved() instead
.. seealso:: :py:func:`layersWillBeRemoved`
.. seealso:: :py:func:`layerRemoved`
%End
void layersRemoved( const QStringList &layerIds );
%Docstring
Emitted after one or more layers were removed from the registry.
:param layerIds: A list of IDs of the layers which were removed.
.. seealso:: :py:func:`layersWillBeRemoved`
%End
void layerRemoved( const QString &layerId );
%Docstring
Emitted after a layer was removed from the registry.
:param layerId: The ID of the layer removed.
.. note::
Consider using layersRemoved() instead
.. seealso:: :py:func:`layerWillBeRemoved`
%End
void removeAll();
void layersAdded( const QList<QgsMapLayer *> &layers );
%Docstring
Emitted when one or more layers were added to the registry.
This signal is also emitted for layers added to the registry,
but not to the legend.
:param layers: List of layers which have been added.
.. seealso:: :py:func:`legendLayersAdded`
.. seealso:: :py:func:`layerWasAdded`
%End
void layerWasAdded( QgsMapLayer *layer );
%Docstring
Emitted when a layer was added to the registry.
.. note::
Consider using layersAdded() instead
.. seealso:: :py:func:`layersAdded`
%End
void legendLayersAdded( const QList<QgsMapLayer *> &layers );
%Docstring
Emitted, when a layer was added to the registry and the legend.
Layers can also be private layers, which are signalled by
layersAdded() and layerWasAdded() but will not be
advertised by this signal.
:param layers: List of QgsMapLayer which were added to the legend.
%End
void isDirtyChanged( bool dirty );
%Docstring
Emitted when the project dirty status changes.
:param dirty: True if the project is in a dirty state and has pending unsaved changes.
.. versionadded:: 3.2
%End
public slots:
void setSnappingConfig( const QgsSnappingConfig &snappingConfig );
%Docstring
The snapping configuration for this project.
.. versionadded:: 3.0
%End
void setDirty( bool b = true );
%Docstring
Flag the project as dirty (modified). If this flag is set, the user will
be asked to save changes to the project before closing the current project.
.. note::
promoted to public slot in 2.16
.. versionadded:: 2.4
%End
void setPresetHomePath( const QString &path );
%Docstring
Sets the project's home ``path``. If an empty path is specified than the
home path will be automatically determined from the project's file path.
.. seealso:: :py:func:`presetHomePath`
.. seealso:: :py:func:`homePath`
.. seealso:: :py:func:`homePathChanged`
.. versionadded:: 3.2
%End
void registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId );
%Docstring
Registers the containers that require translation into the translationContext.
This is a recursive function to get all the child containers.
:param translationContext: where the objects will be registered
:param parent: parent-container containing list of children
:param layerId: to store under the correct context
.. versionadded:: 3.4
%End
void registerTranslatableObjects( QgsTranslationContext *translationContext );
%Docstring
Registers the objects that require translation into the ``translationContext``.
So there can be created a ts file with these values.
.. versionadded:: 3.4
%End
};
class QgsProjectDirtyBlocker
{
%Docstring
Temporarily blocks QgsProject "dirtying" for the lifetime of the object.
QgsProjectDirtyBlocker supports "stacked" blocking, so two QgsProjectDirtyBlockers created
for the same project will both need to be destroyed before the project can be dirtied again.
Note that QgsProjectDirtyBlocker only blocks calls which set the project as dirty - calls
which set the project as clean are not blocked.
Python scripts should not use QgsProjectDirtyBlocker directly. Instead, use :py:func:`QgsProject.blockDirtying()`
.. code-block:: python
project = QgsProject.instance()
with QgsProject.blockDirtying(project):
# do something
.. seealso:: :py:func:`QgsProject.setDirty`
.. versionadded:: 3.2
%End
%TypeHeaderCode
#include "qgsproject.h"
%End
public:
QgsProjectDirtyBlocker( QgsProject *project );
%Docstring
Constructor for QgsProjectDirtyBlocker.
This will block dirtying the specified ``project`` for the lifetime of this object.
%End
~QgsProjectDirtyBlocker();
private:
QgsProjectDirtyBlocker( const QgsProjectDirtyBlocker &other );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsproject.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/