QGIS API Documentation 3.38.0-Grenoble (exported)
|
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc. More...
#include <qgsproject.h>
Public Types | |
enum class | DataDefinedServerProperty : int { NoProperty = 0 , AllProperties = 1 , WMSOnlineResource = 2 } |
Data defined properties. More... | |
Public Slots | |
bool | commitChanges (QStringList &commitErrors, bool stopEditing=true, QgsVectorLayer *vectorLayer=nullptr) |
Attempts to commit to the underlying data provider any buffered changes made since the last to call to startEditing(). | |
QgsPropertyCollection | dataDefinedServerProperties () const |
Returns the data defined properties used for overrides in user defined server parameters. | |
void | registerTranslatableContainers (QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId) |
Registers the containers that require translation into the translationContext. | |
void | registerTranslatableObjects (QgsTranslationContext *translationContext) |
Registers the objects that require translation into the translationContext. | |
bool | rollBack (QStringList &rollbackErrors, bool stopEditing=true, QgsVectorLayer *vectorLayer=nullptr) |
Stops a current editing operation on vectorLayer and discards any uncommitted edits. | |
void | setDataDefinedServerProperties (const QgsPropertyCollection &properties) |
Sets the data defined properties used for overrides in user defined server parameters to properties. | |
void | setDirty (bool b=true) |
Flag the project as dirty (modified). | |
void | setPresetHomePath (const QString &path) |
Sets the project's home path. | |
void | setSnappingConfig (const QgsSnappingConfig &snappingConfig) |
The snapping configuration for this project. | |
bool | startEditing (QgsVectorLayer *vectorLayer=nullptr) |
Makes the layer editable. | |
Signals | |
void | aboutToBeCleared () |
Emitted when the project is about to be cleared. | |
void | areaUnitsChanged () |
Emitted when the default area units changes. | |
void | avoidIntersectionsLayersChanged () |
Emitted whenever avoidIntersectionsLayers has changed. | |
void | avoidIntersectionsModeChanged () |
Emitted whenever the avoid intersections mode has changed. | |
void | backgroundColorChanged () |
Emitted whenever the project's canvas background color has been changed. | |
void | cleared () |
Emitted when the project is cleared (and additionally when an open project is cleared just before a new project is read). | |
void | crs3DChanged () |
Emitted when the crs3D() of the project has changed. | |
void | crsChanged () |
Emitted when the crs() of the project has changed. | |
void | customVariablesChanged () |
Emitted whenever the expression variables stored in the project have been changed. | |
void | dirtySet () |
Emitted when setDirty(true) is called. | |
void | distanceUnitsChanged () |
Emitted when the default distance units changes. | |
void | elevationShadingRendererChanged () |
Emitted when the map shading renderer changes. | |
void | ellipsoidChanged (const QString &ellipsoid) |
Emitted when the project ellipsoid is changed. | |
void | fileNameChanged () |
Emitted when the file name of the project changes. | |
void | homePathChanged () |
Emitted when the home path of the project changes. | |
void | isDirtyChanged (bool dirty) |
Emitted when the project dirty status changes. | |
void | labelingEngineSettingsChanged () |
Emitted when global configuration of the labeling engine changes. | |
void | layerLoaded (int i, int n) |
Emitted when a layer from a projects was read. | |
void | layerRemoved (const QString &layerId) |
Emitted after a layer was removed from the registry. | |
void | layersAdded (const QList< QgsMapLayer * > &layers) |
Emitted when one or more layers were added to the registry. | |
void | layersRemoved (const QStringList &layerIds) |
Emitted after one or more layers were removed from the registry. | |
void | layersWillBeRemoved (const QList< QgsMapLayer * > &layers) |
Emitted when one or more layers are about to be removed from the registry. | |
void | layersWillBeRemoved (const QStringList &layerIds) |
Emitted when one or more layers are about to be removed from the registry. | |
void | layerWasAdded (QgsMapLayer *layer) |
Emitted when a layer was added to the registry. | |
void | layerWillBeRemoved (const QString &layerId) |
Emitted when a layer is about to be removed from the registry. | |
void | layerWillBeRemoved (QgsMapLayer *layer) |
Emitted when a layer is about to be removed from the registry. | |
void | legendLayersAdded (const QList< QgsMapLayer * > &layers) |
Emitted, when a layer was added to the registry and the legend. | |
void | loadingLayer (const QString &layerName) |
Emitted when a layer is loaded. | |
void | loadingLayerMessageReceived (const QString &layerName, const QList< QgsReadWriteContext::ReadWriteMessage > &messages) |
Emitted when loading layers has produced some messages. | |
Q_DECL_DEPRECATED void | mapScalesChanged () |
Emitted when the list of custom project map scales changes. | |
void | mapThemeCollectionChanged () |
Emitted when the map theme collection changes. | |
void | metadataChanged () |
Emitted when the project's metadata is changed. | |
void | missingDatumTransforms (const QStringList &missingTransforms) |
Emitted when datum transforms stored in the project are not available locally. | |
Q_DECL_DEPRECATED void | nonIdentifiableLayersChanged (QStringList nonIdentifiableLayers) |
Emitted when the list of layer which are excluded from map identification changes. | |
Q_DECL_DEPRECATED void | oldProjectVersionWarning (const QString &) |
Emitted when an old project file is read. | |
void | projectColorsChanged () |
Emitted whenever the project's color scheme has been changed. | |
void | projectSaved () |
Emitted when the project file has been written and closed. | |
void | readMapLayer (QgsMapLayer *mapLayer, const QDomElement &layerNode) |
Emitted after the basic initialization of a layer from the project file is done. | |
void | readProject (const QDomDocument &) |
Emitted when a project is being read. | |
void | readProjectWithContext (const QDomDocument &, QgsReadWriteContext &context) |
Emitted when a project is being read. | |
void | readVersionMismatchOccurred (const QString &fileVersion) |
Emitted when a project is read and the version of QGIS used to save the project differs from the current QGIS version. | |
void | removeAll () |
Emitted when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals are emitted. | |
void | selectionColorChanged () |
Emitted whenever the project's selection color has been changed. | |
void | snappingConfigChanged (const QgsSnappingConfig &config) |
Emitted whenever the configuration for snapping has changed. | |
void | topologicalEditingChanged () |
Emitted when the topological editing flag has changed. | |
void | transactionGroupsChanged () |
Emitted whenever a new transaction group has been created or a transaction group has been removed. | |
void | transactionModeChanged () |
Emitted when the transaction mode has changed. | |
void | transformContextChanged () |
Emitted when the project transformContext() is changed. | |
void | verticalCrsChanged () |
Emitted when the verticalCrs() of the project has changed. | |
void | writeMapLayer (QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc) |
Emitted when a layer is being saved. | |
void | writeProject (QDomDocument &) |
Emitted when the project is being written. | |
Public Member Functions | |
QgsProject (QObject *parent=nullptr, Qgis::ProjectCapabilities capabilities=Qgis::ProjectCapability::ProjectStyles) | |
Create a new QgsProject. | |
~QgsProject () override | |
QString | absoluteFilePath () const |
Returns full absolute path to the project file if the project is stored in a file system - derived from fileName(). | |
QString | absolutePath () const |
Returns full absolute path to the project folder if the project is stored in a file system - derived from fileName(). | |
bool | accept (QgsStyleEntityVisitorInterface *visitor) const |
Accepts the specified style entity visitor, causing it to visit all style entities associated with the project. | |
QgsMapLayer * | addMapLayer (QgsMapLayer *mapLayer, bool addToLegend=true, bool takeOwnership=true) |
Add a layer to the map of loaded layers. | |
QList< QgsMapLayer * > | addMapLayers (const QList< QgsMapLayer * > &mapLayers, bool addToLegend=true, bool takeOwnership=true) |
Add a list of layers to the map of loaded layers. | |
QgsAnnotationManager * | annotationManager () |
Returns pointer to the project's annotation manager. | |
const QgsAnnotationManager * | annotationManager () const |
Returns a const pointer to the project's annotation manager. | |
Qgis::AreaUnit | areaUnits () const |
Convenience function to query default area measurement units for project. | |
QStringList | attachedFiles () const |
Returns a map of all attached files with identifier and real paths. | |
QString | attachmentIdentifier (const QString &attachedFile) const |
Returns an identifier for an attachment file path An attachment identifier is a string which does not depend on the project archive storage location. | |
Q_DECL_DEPRECATED bool | autoTransaction () const |
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. | |
QgsAuxiliaryStorage * | auxiliaryStorage () |
Returns the current auxiliary storage. | |
const QgsAuxiliaryStorage * | auxiliaryStorage () const |
Returns the current const auxiliary storage. | |
QList< QgsVectorLayer * > | avoidIntersectionsLayers () const |
A list of layers with which intersections should be avoided. | |
Qgis::AvoidIntersectionsMode | avoidIntersectionsMode () const |
Returns the current avoid intersections mode. | |
QColor | backgroundColor () const |
Returns the default background color used by default map canvases. | |
QString | baseName () const |
Returns the base name of the project file without the path and without extension - derived from fileName(). | |
QgsBookmarkManager * | bookmarkManager () |
Returns the project's bookmark manager, which manages bookmarks within the project. | |
const QgsBookmarkManager * | bookmarkManager () const |
Returns the project's bookmark manager, which manages bookmarks within the project. | |
Qgis::ProjectCapabilities | capabilities () const |
Returns the project's capabilities, which dictate optional functionality which can be selectively enabled for a QgsProject object. | |
void | clear () |
Clears the project, removing all settings and resetting it back to an empty, default state. | |
int | count () const |
Returns the number of registered layers. | |
QString | createAttachedFile (const QString &nameTemplate) |
Attaches a file to the project. | |
QgsLayerTreeGroup * | createEmbeddedGroup (const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers, Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
Create layer group instance defined in an arbitrary project file. | |
bool | createEmbeddedLayer (const QString &layerId, const QString &projectFilePath, QList< QDomNode > &brokenNodes, bool saveFlag=true, Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
Creates a maplayer instance defined in an arbitrary project file. | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. | |
QgsExpressionContextScope * | createExpressionContextScope () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. | |
QgsCoordinateReferenceSystem | crs () const |
Returns the project's native coordinate reference system. | |
QgsCoordinateReferenceSystem | crs3D () const |
Returns the CRS to use for the project when transforming 3D data, or when z/elevation value handling is important. | |
QVariantMap | customVariables () const |
A map of custom project variables. | |
QgsCoordinateReferenceSystem | defaultCrsForNewLayers () const |
Returns the default CRS for new layers based on the settings and the current project CRS. | |
QgsProjectDisplaySettings * | displaySettings () |
Returns the project's display settings, which contains settings and properties relating to how a QgsProject should display values such as map coordinates and bearings. | |
const QgsProjectDisplaySettings * | displaySettings () const |
Returns the project's display settings, which contains settings and properties relating to how a QgsProject should display values such as map coordinates and bearings. | |
Qgis::DistanceUnit | distanceUnits () const |
Convenience function to query default distance measurement units for project. | |
void | dumpProperties () const |
Dump out current project properties to stderr. | |
QgsVectorLayerEditBufferGroup * | editBufferGroup () |
Returns the edit buffer group. | |
QgsProjectElevationProperties * | elevationProperties () |
Returns the project's elevation properties, which contains the project's elevation related settings. | |
const QgsProjectElevationProperties * | elevationProperties () const |
Returns the project's elevation properties, which contains the project's elevation related settings. | |
QgsElevationShadingRenderer | elevationShadingRenderer () const |
Returns the elevation shading renderer used for map shading. | |
QString | ellipsoid () const |
Returns a proj string representing the project's ellipsoid setting, e.g., "WGS84". | |
QStringList | entryList (const QString &scope, const QString &key) const |
Returns a list of child keys with values which exist within the the specified scope and key. | |
QString | error () const |
Returns error message from previous read/write. | |
Q_DECL_DEPRECATED bool | evaluateDefaultValues () const |
Should default values be evaluated on provider side when requested and not when committed. | |
Q_DECL_DEPRECATED QFileInfo | fileInfo () const |
Returns QFileInfo object for the project's associated file. | |
QString | fileName () const |
Returns the project's file name. | |
Qgis::FilePathType | filePathStorage () const |
Returns the type of paths used when storing file paths in a QGS/QGZ project file. | |
Qgis::ProjectFlags | flags () const |
Returns the project's flags, which dictate the behavior of the project. | |
void | generateTsFile (const QString &locale) |
Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile() | |
QgsProjectGpsSettings * | gpsSettings () |
Returns the project's GPS settings, which contains settings and properties relating to how a QgsProject should interact with a GPS device. | |
const QgsProjectGpsSettings * | gpsSettings () const |
Returns the project's GPS settings, which contains settings and properties relating to how a QgsProject should interact with a GPS device. | |
QString | homePath () const |
Returns the project's home path. | |
bool | isDirty () const |
Returns true if the project has been modified since the last write() | |
bool | isZipped () const |
Returns true if the project comes from a zip archive, false otherwise. | |
const QgsLabelingEngineSettings & | labelingEngineSettings () const |
Returns project's global labeling engine settings. | |
QDateTime | lastModified () const |
Returns last modified time of the project file as returned by the file system (or other project storage). | |
QDateTime | lastSaveDateTime () const |
Returns the date and time when the project was last saved. | |
QgsProjectVersion | lastSaveVersion () const |
Returns the QGIS version which the project was last saved using. | |
QString | layerIsEmbedded (const QString &id) const |
Returns the source project file path if the layer with matching id is embedded from other project file. | |
template<typename T > | |
QVector< T > | layers () const |
Returns a list of registered map layers with a specified layer type. | |
QgsMapLayerStore * | layerStore () |
Returns a pointer to the project's internal layer store. | |
const QgsMapLayerStore * | layerStore () const |
Returns a pointer to the project's internal layer store. | |
QgsLayerTreeRegistryBridge * | layerTreeRegistryBridge () const |
Returns pointer to the helper class that synchronizes map layer registry with layer tree. | |
QgsLayerTree * | layerTreeRoot () const |
Returns pointer to the root (invisible) node of the project's layer tree. | |
QgsLayoutManager * | layoutManager () |
Returns the project's layout manager, which manages print layouts, atlases and reports within the project. | |
const QgsLayoutManager * | layoutManager () const |
Returns the project's layout manager, which manages print layouts, atlases and reports within the project. | |
QgsAnnotationLayer * | mainAnnotationLayer () |
Returns the main annotation layer associated with the project. | |
Q_INVOKABLE QgsMapLayer * | mapLayer (const QString &layerId) const |
Retrieve a pointer to a registered layer by layer ID. | |
template<class T > | |
T | mapLayer (const QString &layerId) const |
Retrieve a pointer to a registered layer by layerId converted to type T. | |
QMap< QString, QgsMapLayer * > | mapLayers (const bool validOnly=false) const |
Returns a map of all registered layers by layer ID. | |
Q_INVOKABLE QList< QgsMapLayer * > | mapLayersByName (const QString &layerName) const |
Retrieve a list of matching registered layers by layer name. | |
QList< QgsMapLayer * > | mapLayersByShortName (const QString &shortName) const |
Retrieves a list of matching registered layers by layer shortName. | |
template<typename T > | |
QVector< T > | mapLayersByShortName (const QString &shortName) const |
Retrieves a list of matching registered layers by layer shortName with a specified layer type, if layer's short name is empty a match with layer's name is attempted. | |
Q_DECL_DEPRECATED QVector< double > | mapScales () const |
Returns the list of custom project map scales. | |
QgsMapThemeCollection * | mapThemeCollection () |
Returns pointer to the project's map theme collection. | |
const QgsProjectMetadata & | metadata () const |
Returns a reference to the project's metadata store. | |
Q_DECL_DEPRECATED QStringList | nonIdentifiableLayers () const |
Gets the list of layers which currently should not be taken into account on map identification. | |
QString | originalPath () const |
Returns the original path associated with the project. | |
QgsPathResolver | pathResolver () const |
Returns path resolver object with considering whether the project uses absolute or relative paths and using current project's path. | |
QString | presetHomePath () const |
Returns any manual project home path setting, or an empty string if not set. | |
QgsProjectStorage * | projectStorage () const |
Returns pointer to project storage implementation that handles read/write of the project file. | |
bool | read (const QString &filename, Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
Reads given project file from the given file. | |
bool | read (Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
Reads the project from its currently associated file (see fileName() ). | |
bool | readBoolEntry (const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const |
Reads a boolean from the specified scope and key. | |
double | readDoubleEntry (const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const |
Reads a double from the specified scope and key. | |
QString | readEntry (const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const |
Reads a string from the specified scope and key. | |
bool | readLayer (const QDomNode &layerNode) |
Reads the layer described in the associated DOM node. | |
QStringList | readListEntry (const QString &scope, const QString &key, const QStringList &def=QStringList(), bool *ok=nullptr) const |
Reads a string list from the specified scope and key. | |
int | readNumEntry (const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const |
Reads an integer from the specified scope and key. | |
QString | readPath (const QString &filename) const |
Transforms a filename read from the project file to an absolute path. | |
QgsRelationManager * | relationManager () const |
void | reloadAllLayers () |
Reload all registered layer's provider data caches, synchronising the layer with any changes in the datasource. | |
void | removeAllMapLayers () |
Removes all registered layers. | |
bool | removeAttachedFile (const QString &path) |
Removes the attached file. | |
bool | removeEntry (const QString &scope, const QString &key) |
Remove the given key from the specified scope. | |
void | removeMapLayer (const QString &layerId) |
Remove a layer from the registry by layer ID. | |
void | removeMapLayer (QgsMapLayer *layer) |
Remove a layer from the registry. | |
void | removeMapLayers (const QList< QgsMapLayer * > &layers) |
Remove a set of layers from the registry. | |
void | removeMapLayers (const QStringList &layerIds) |
Remove a set of layers from the registry by layer ID. | |
Q_DECL_DEPRECATED QSet< QgsMapLayer * > | requiredLayers () const |
Returns a set of map layers that are required in the project and therefore they should not get removed from the project. | |
QString | resolveAttachmentIdentifier (const QString &identifier) const |
Resolves an attachment identifier to a attachment file path. | |
QString | saveUser () const |
Returns the user name that did the last save. | |
QString | saveUserFullName () const |
Returns the full user name that did the last save. | |
QColor | selectionColor () const |
Returns the color used to highlight selected features. | |
QgsSensorManager * | sensorManager () |
Returns the project's sensor manager, which manages sensors within the project. | |
const QgsSensorManager * | sensorManager () const |
Returns the project's sensor manager, which manages sensors within the project. | |
void | setAreaUnits (Qgis::AreaUnit unit) |
Sets the default area measurement units for the project. | |
Q_DECL_DEPRECATED void | setAutoTransaction (bool autoTransaction) |
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. | |
void | setAvoidIntersectionsLayers (const QList< QgsVectorLayer * > &layers) |
Sets the list of layers with which intersections should be avoided. | |
void | setAvoidIntersectionsMode (const Qgis::AvoidIntersectionsMode mode) |
Sets the avoid intersections mode. | |
void | setBackgroundColor (const QColor &color) |
Sets the default background color used by default map canvases. | |
void | setBadLayerHandler (QgsProjectBadLayerHandler *handler) |
Change handler for missing layers. | |
void | setCrs (const QgsCoordinateReferenceSystem &crs, bool adjustEllipsoid=false) |
Sets the project's native coordinate reference system. | |
void | setCustomVariables (const QVariantMap &customVariables) |
A map of custom project variables. | |
void | setDistanceUnits (Qgis::DistanceUnit unit) |
Sets the default distance measurement units for the project. | |
void | setElevationShadingRenderer (const QgsElevationShadingRenderer &elevationShadingRenderer) |
Sets the elevation shading renderer used for global map shading. | |
void | setEllipsoid (const QString &ellipsoid) |
Sets the project's ellipsoid from a proj string representation, e.g., "WGS84". | |
Q_DECL_DEPRECATED void | setEvaluateDefaultValues (bool evaluateDefaultValues) |
Defines if default values should be evaluated on provider side when requested and not when committed. | |
void | setFileName (const QString &name) |
Sets the file name associated with the project. | |
void | setFilePathStorage (Qgis::FilePathType type) |
Sets the type of paths used when storing file paths in a QGS/QGZ project file. | |
void | setFlag (Qgis::ProjectFlag flag, bool enabled=true) |
Sets whether a project flag is enabled. | |
void | setFlags (Qgis::ProjectFlags flags) |
Sets the project's flags, which dictate the behavior of the project. | |
void | setLabelingEngineSettings (const QgsLabelingEngineSettings &settings) |
Sets project's global labeling engine settings. | |
Q_DECL_DEPRECATED void | setMapScales (const QVector< double > &scales) |
Sets the list of custom project map scales. | |
void | setMetadata (const QgsProjectMetadata &metadata) |
Sets the project's metadata store. | |
Q_DECL_DEPRECATED void | setNonIdentifiableLayers (const QList< QgsMapLayer * > &layers) |
Set a list of layers which should not be taken into account on map identification. | |
Q_DECL_DEPRECATED void | setNonIdentifiableLayers (const QStringList &layerIds) |
Set a list of layers which should not be taken into account on map identification. | |
void | setOriginalPath (const QString &path) |
Sets the original path associated with the project. | |
void | setProjectColors (const QgsNamedColorList &colors) |
Sets the colors for the project's color scheme (see QgsProjectColorScheme). | |
Q_DECL_DEPRECATED void | setRequiredLayers (const QSet< QgsMapLayer * > &layers) |
Configures a set of map layers that are required in the project and therefore they should not get removed from the project. | |
void | setSelectionColor (const QColor &color) |
Sets the color used to highlight selected features. | |
void | setTitle (const QString &title) |
Sets the project's title. | |
void | setTopologicalEditing (bool enabled) |
Convenience function to set topological editing. | |
bool | setTransactionMode (Qgis::TransactionMode transactionMode) |
Set transaction mode. | |
void | setTransformContext (const QgsCoordinateTransformContext &context) |
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. | |
Q_DECL_DEPRECATED void | setTrustLayerMetadata (bool trust) |
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. | |
Q_DECL_DEPRECATED void | setUseProjectScales (bool enabled) |
Sets whether project mapScales() are enabled. | |
bool | setVerticalCrs (const QgsCoordinateReferenceSystem &crs, QString *errorMessage=nullptr) |
Sets the project's vertical coordinate reference system. | |
QgsSnappingConfig | snappingConfig () const |
The snapping configuration for this project. | |
QgsProjectStyleSettings * | styleSettings () |
Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling. | |
const QgsProjectStyleSettings * | styleSettings () const |
Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling. | |
QStringList | subkeyList (const QString &scope, const QString &key) const |
Returns a list of child keys which contain other keys that exist within the the specified scope and key. | |
QgsMapLayer * | takeMapLayer (QgsMapLayer *layer) |
Takes a layer from the registry. | |
QgsProjectTimeSettings * | timeSettings () |
Returns the project's time settings, which contains the project's temporal range and other time based settings. | |
const QgsProjectTimeSettings * | timeSettings () const |
Returns the project's time settings, which contains the project's temporal range and other time based settings. | |
QString | title () const |
Returns the project's title. | |
bool | topologicalEditing () const |
Convenience function to query topological editing status. | |
QgsTransactionGroup * | transactionGroup (const QString &providerKey, const QString &connString) |
Returns the matching transaction group from a provider key and connection string. | |
QMap< QPair< QString, QString >, QgsTransactionGroup * > | transactionGroups () |
Map of transaction groups. | |
Qgis::TransactionMode | transactionMode () const |
Returns the transaction mode. | |
QgsCoordinateTransformContext | transformContext () const |
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. | |
QString | translate (const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const override |
Translates the project with QTranslator and qm file. | |
Q_DECL_DEPRECATED bool | trustLayerMetadata () const |
Returns true if the trust option is activated, false otherwise. | |
Q_DECL_DEPRECATED bool | useProjectScales () const |
Returns true if project mapScales() are enabled. | |
int | validCount () const |
Returns the number of registered valid layers. | |
QgsCoordinateReferenceSystem | verticalCrs () const |
Returns the project's vertical coordinate reference system. | |
QgsProjectViewSettings * | viewSettings () |
Returns the project's view settings, which contains settings and properties relating to how a QgsProject should be viewed and behave inside a map canvas (e.g. | |
const QgsProjectViewSettings * | viewSettings () const |
Returns the project's view settings, which contains settings and properties relating to how a QgsProject should be viewed and behave inside a map canvas (e.g. | |
QgsMapViewsManager * | viewsManager () |
Returns the project's views manager, which manages map views (including 3d maps) in the project. | |
const QgsMapViewsManager * | viewsManager () const |
Returns the project's views manager, which manages map views (including 3d maps) in the project. | |
bool | write () |
Writes the project to its current associated file (see fileName() ). | |
bool | write (const QString &filename) |
Writes the project to a file. | |
bool | writeEntry (const QString &scope, const QString &key, bool value) |
Write a boolean value to the project file. | |
bool | writeEntry (const QString &scope, const QString &key, const QString &value) |
Write a string value to the project file. | |
bool | writeEntry (const QString &scope, const QString &key, const QStringList &value) |
Write a string list value to the project file. | |
bool | writeEntry (const QString &scope, const QString &key, double value) |
Write a double value to the project file. | |
bool | writeEntry (const QString &scope, const QString &key, int value) |
Write an integer value to the project file. | |
QString | writePath (const QString &filename) const |
Prepare a filename to save it to the project file. | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Public Member Functions inherited from QgsExpressionContextScopeGenerator | |
virtual | ~QgsExpressionContextScopeGenerator ()=default |
Public Member Functions inherited from QgsProjectTranslator | |
virtual | ~QgsProjectTranslator ()=default |
Static Public Member Functions | |
static QgsProject * | instance () |
Returns the QgsProject singleton instance. | |
static void | setInstance (QgsProject *project) |
Set the current project singleton instance to project. | |
Friends | |
class | QgsApplication |
class | QgsProjectDirtyBlocker |
class | QgsProviderRegistry |
class | QgsServer |
class | TestQgsProject |
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
QgsProject is available both as a singleton (QgsProject::instance()) and for use as standalone objects. The QGIS project singleton always gives access to the canonical project reference open within the main QGIS application.
Definition at line 106 of file qgsproject.h.
|
strong |
Data defined properties.
Overrides of user defined server parameters are stored in a property collection and they can be retrieved using the indexes specified in this enum.
Enumerator | |
---|---|
NoProperty | No property. |
AllProperties | All properties for item. |
WMSOnlineResource | Alias. |
Definition at line 141 of file qgsproject.h.
|
explicit |
Create a new QgsProject.
Most of the time you want to use QgsProject::instance() instead as many components of QGIS work with the singleton.
Since QGIS 3.26.1 the capabilities argument specifies optional capabilities which can be selectively enabled for the project. These affect the QgsProject object for its entire lifetime.
Definition at line 369 of file qgsproject.cpp.
|
override |
Definition at line 459 of file qgsproject.cpp.
|
signal |
QString QgsProject::absoluteFilePath | ( | ) | const |
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).
Definition at line 882 of file qgsproject.cpp.
QString QgsProject::absolutePath | ( | ) | const |
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).
Definition at line 869 of file qgsproject.cpp.
bool QgsProject::accept | ( | QgsStyleEntityVisitorInterface * | visitor | ) | const |
Accepts the specified style entity visitor, causing it to visit all style entities associated with the project.
Returns true
if the visitor should continue visiting other objects, or false
if visiting should be canceled.
Definition at line 5194 of file qgsproject.cpp.
QgsMapLayer * QgsProject::addMapLayer | ( | QgsMapLayer * | mapLayer, |
bool | addToLegend = true , |
||
bool | takeOwnership = true |
||
) |
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.
mapLayer | A layer to add to the registry |
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. |
takeOwnership | Ownership will be transferred to the layer registry. If you specify false here you have take care of deleting the layer yourself. Not available in Python. |
nullptr
if unable to add layer, otherwise pointer to newly added layerDefinition at line 4730 of file qgsproject.cpp.
QList< QgsMapLayer * > QgsProject::addMapLayers | ( | const QList< QgsMapLayer * > & | mapLayers, |
bool | addToLegend = true , |
||
bool | takeOwnership = true |
||
) |
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
.
mapLayers | A list of layer which should be added to the registry |
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. |
takeOwnership | Ownership will be transferred to the layer registry. If you specify false here you have take care of deleting the layers yourself. Not available in Python. |
Definition at line 4688 of file qgsproject.cpp.
QgsAnnotationManager * QgsProject::annotationManager | ( | ) |
Returns pointer to the project's annotation manager.
Definition at line 4353 of file qgsproject.cpp.
const QgsAnnotationManager * QgsProject::annotationManager | ( | ) | const |
Returns a const pointer to the project's annotation manager.
Definition at line 4360 of file qgsproject.cpp.
|
inline |
Convenience function to query default area measurement units for project.
Definition at line 783 of file qgsproject.h.
|
signal |
QStringList QgsProject::attachedFiles | ( | ) | const |
Returns a map of all attached files with identifier and real paths.
Definition at line 4977 of file qgsproject.cpp.
QString QgsProject::attachmentIdentifier | ( | const QString & | attachedFile | ) | const |
Returns an identifier for an attachment file path An attachment identifier is a string which does not depend on the project archive storage location.
attachedFile | An attachment file path |
Definition at line 5002 of file qgsproject.cpp.
bool QgsProject::autoTransaction | ( | ) | const |
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.
Definition at line 4422 of file qgsproject.cpp.
QgsAuxiliaryStorage * QgsProject::auxiliaryStorage | ( | ) |
Returns the current auxiliary storage.
Definition at line 4958 of file qgsproject.cpp.
const QgsAuxiliaryStorage * QgsProject::auxiliaryStorage | ( | ) | const |
Returns the current const auxiliary storage.
Definition at line 4951 of file qgsproject.cpp.
QList< QgsVectorLayer * > QgsProject::avoidIntersectionsLayers | ( | ) | const |
A list of layers with which intersections should be avoided.
Definition at line 2775 of file qgsproject.cpp.
|
signal |
Emitted whenever avoidIntersectionsLayers has changed.
|
inline |
Returns the current avoid intersections mode.
Definition at line 1132 of file qgsproject.h.
|
signal |
Emitted whenever the avoid intersections mode has changed.
QColor QgsProject::backgroundColor | ( | ) | const |
Returns the default background color used by default map canvases.
Definition at line 5110 of file qgsproject.cpp.
|
signal |
Emitted whenever the project's canvas background color has been changed.
QString QgsProject::baseName | ( | ) | const |
Returns the base name of the project file without the path and without extension - derived from fileName().
Definition at line 896 of file qgsproject.cpp.
QgsBookmarkManager * QgsProject::bookmarkManager | ( | ) |
Returns the project's bookmark manager, which manages bookmarks within the project.
Definition at line 4233 of file qgsproject.cpp.
const QgsBookmarkManager * QgsProject::bookmarkManager | ( | ) | const |
Returns the project's bookmark manager, which manages bookmarks within the project.
Definition at line 4226 of file qgsproject.cpp.
|
inline |
Returns the project's capabilities, which dictate optional functionality which can be selectively enabled for a QgsProject object.
Definition at line 198 of file qgsproject.h.
void QgsProject::clear | ( | ) |
Clears the project, removing all settings and resetting it back to an empty, default state.
Definition at line 1162 of file qgsproject.cpp.
|
signal |
Emitted when the project is cleared (and additionally when an open project is cleared just before a new project is read).
|
slot |
Attempts to commit to the underlying data provider any buffered changes made since the last to call to startEditing().
Returns the result of the attempt. If a commit fails (i.e. false
is returned), the in-memory changes are left untouched and are not discarded. This allows editing to continue if the commit failed on e.g. a disallowed value in a Postgres database - the user can re-edit and try again.
The commits occur in distinct stages, (add attributes, add features, change attribute values, change geometries, delete features, delete attributes) so if a stage fails, it can be difficult to roll back cleanly. Therefore any error message returned by commitErrors also includes which stage failed so that the user has some chance of repairing the damage cleanly.
commitErrors | will be set to a list of descriptive errors if the commit fails. |
stopEditing | if set to false , the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the commit is successful. |
vectorLayer | for which the changes will be committed. For buffered transactions this parameter is not mandatory, as the changes from all layers will be committed. |
true
if the commit was successful.Definition at line 742 of file qgsproject.cpp.
int QgsProject::count | ( | ) | const |
Returns the number of registered layers.
Definition at line 4493 of file qgsproject.cpp.
QString QgsProject::createAttachedFile | ( | const QString & | nameTemplate | ) |
Attaches a file to the project.
nameTemplate | Any filename template, used as a basename for attachment file, i.e. "myfile.ext" |
Definition at line 4965 of file qgsproject.cpp.
QgsLayerTreeGroup * QgsProject::createEmbeddedGroup | ( | const QString & | groupName, |
const QString & | projectFilePath, | ||
const QStringList & | invisibleLayers, | ||
Qgis::ProjectReadFlags | flags = Qgis::ProjectReadFlags() |
||
) |
Create layer group instance defined in an arbitrary project file.
The optional flags argument can be used to control layer reading behavior.
Definition at line 3974 of file qgsproject.cpp.
bool QgsProject::createEmbeddedLayer | ( | const QString & | layerId, |
const QString & | projectFilePath, | ||
QList< QDomNode > & | brokenNodes, | ||
bool | saveFlag = true , |
||
Qgis::ProjectReadFlags | flags = Qgis::ProjectReadFlags() |
||
) |
Creates a maplayer instance defined in an arbitrary project file.
Caller takes ownership.
The optional flags argument can be used to specify flags which control layer reading.
Definition at line 3878 of file qgsproject.cpp.
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 2802 of file qgsproject.cpp.
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context scope.
Implements QgsExpressionContextScopeGenerator.
Definition at line 2814 of file qgsproject.cpp.
QgsCoordinateReferenceSystem QgsProject::crs | ( | ) | const |
Returns the project's native coordinate reference system.
Definition at line 936 of file qgsproject.cpp.
QgsCoordinateReferenceSystem QgsProject::crs3D | ( | ) | const |
Returns the CRS to use for the project when transforming 3D data, or when z/elevation value handling is important.
The returned CRS will take into account verticalCrs() when appropriate, e.g. it may return a compound CRS consisting of crs() + verticalCrs(). This method may still return a 2D CRS, e.g in the case that crs() is a 2D CRS and no verticalCrs() has been set for the project. Check QgsCoordinateReferenceSystem::type() on the returned value to determine the type of CRS returned by this method.
Definition at line 944 of file qgsproject.cpp.
|
signal |
Emitted when the crs3D() of the project has changed.
|
signal |
Emitted when the crs() of the project has changed.
QVariantMap QgsProject::customVariables | ( | ) | const |
A map of custom project variables.
To get all available variables including generated ones use QgsExpressionContextUtils::projectScope() instead.
Definition at line 2710 of file qgsproject.cpp.
|
signal |
Emitted whenever the expression variables stored in the project have been changed.
|
slot |
Returns the data defined properties used for overrides in user defined server parameters.
Definition at line 714 of file qgsproject.cpp.
QgsCoordinateReferenceSystem QgsProject::defaultCrsForNewLayers | ( | ) | const |
Returns the default CRS for new layers based on the settings and the current project CRS.
Definition at line 4862 of file qgsproject.cpp.
|
signal |
Emitted when setDirty(true) is called.
QgsProjectDisplaySettings * QgsProject::displaySettings | ( | ) |
Returns the project's display settings, which contains settings and properties relating to how a QgsProject should display values such as map coordinates and bearings.
const QgsProjectDisplaySettings * QgsProject::displaySettings | ( | ) | const |
Returns the project's display settings, which contains settings and properties relating to how a QgsProject should display values such as map coordinates and bearings.
Definition at line 4311 of file qgsproject.cpp.
|
inline |
Convenience function to query default distance measurement units for project.
Definition at line 770 of file qgsproject.h.
|
signal |
void QgsProject::dumpProperties | ( | ) | const |
Dump out current project properties to stderr.
Definition at line 3786 of file qgsproject.cpp.
QgsVectorLayerEditBufferGroup * QgsProject::editBufferGroup | ( | ) |
QgsProjectElevationProperties * QgsProject::elevationProperties | ( | ) |
Returns the project's elevation properties, which contains the project's elevation related settings.
Definition at line 4304 of file qgsproject.cpp.
const QgsProjectElevationProperties * QgsProject::elevationProperties | ( | ) | const |
Returns the project's elevation properties, which contains the project's elevation related settings.
Definition at line 4297 of file qgsproject.cpp.
QgsElevationShadingRenderer QgsProject::elevationShadingRenderer | ( | ) | const |
Returns the elevation shading renderer used for map shading.
Definition at line 5224 of file qgsproject.cpp.
|
signal |
Emitted when the map shading renderer changes.
QString QgsProject::ellipsoid | ( | ) | const |
Returns a proj string representing the project's ellipsoid setting, e.g., "WGS84".
Definition at line 983 of file qgsproject.cpp.
|
signal |
Emitted when the project ellipsoid is changed.
QStringList QgsProject::entryList | ( | const QString & | scope, |
const QString & | key | ||
) | const |
Returns a list of child keys with values which exist within the the specified scope and key.
This method does not return keys that contain other keys. See subkeyList() to retrieve keys which contain other keys.
Definition at line 3748 of file qgsproject.cpp.
QString QgsProject::error | ( | ) | const |
Returns error message from previous read/write.
Definition at line 3844 of file qgsproject.cpp.
bool QgsProject::evaluateDefaultValues | ( | ) | const |
Should default values be evaluated on provider side when requested and not when committed.
Definition at line 4075 of file qgsproject.cpp.
QFileInfo QgsProject::fileInfo | ( | ) | const |
Returns QFileInfo object for the project's associated file.
Definition at line 838 of file qgsproject.cpp.
QString QgsProject::fileName | ( | ) | const |
Returns the project's file name.
This is the file or the storage URI which contains the project's XML representation.
Definition at line 816 of file qgsproject.cpp.
|
signal |
Emitted when the file name of the project changes.
Qgis::FilePathType QgsProject::filePathStorage | ( | ) | const |
Returns the type of paths used when storing file paths in a QGS/QGZ project file.
Definition at line 913 of file qgsproject.cpp.
|
inline |
Returns the project's flags, which dictate the behavior of the project.
Definition at line 208 of file qgsproject.h.
void QgsProject::generateTsFile | ( | const QString & | locale | ) |
Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile()
Definition at line 5163 of file qgsproject.cpp.
QgsProjectGpsSettings * QgsProject::gpsSettings | ( | ) |
Returns the project's GPS settings, which contains settings and properties relating to how a QgsProject should interact with a GPS device.
Definition at line 4332 of file qgsproject.cpp.
const QgsProjectGpsSettings * QgsProject::gpsSettings | ( | ) | const |
Returns the project's GPS settings, which contains settings and properties relating to how a QgsProject should interact with a GPS device.
Definition at line 4325 of file qgsproject.cpp.
QString QgsProject::homePath | ( | ) | const |
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).
Definition at line 4128 of file qgsproject.cpp.
|
signal |
Emitted when the home path of the project changes.
|
static |
Returns the QgsProject singleton instance.
Definition at line 481 of file qgsproject.cpp.
bool QgsProject::isDirty | ( | ) | const |
Returns true
if the project has been modified since the last write()
Definition at line 592 of file qgsproject.cpp.
|
signal |
Emitted when the project dirty status changes.
dirty | true if the project is in a dirty state and has pending unsaved changes. |
bool QgsProject::isZipped | ( | ) | const |
Returns true
if the project comes from a zip archive, false
otherwise.
Definition at line 4681 of file qgsproject.cpp.
const QgsLabelingEngineSettings & QgsProject::labelingEngineSettings | ( | ) | const |
Returns project's global labeling engine settings.
Definition at line 2753 of file qgsproject.cpp.
|
signal |
Emitted when global configuration of the labeling engine changes.
QDateTime QgsProject::lastModified | ( | ) | const |
Returns last modified time of the project file as returned by the file system (or other project storage).
Definition at line 853 of file qgsproject.cpp.
QDateTime QgsProject::lastSaveDateTime | ( | ) | const |
Returns the date and time when the project was last saved.
Definition at line 578 of file qgsproject.cpp.
QgsProjectVersion QgsProject::lastSaveVersion | ( | ) | const |
Returns the QGIS version which the project was last saved using.
Definition at line 585 of file qgsproject.cpp.
QString QgsProject::layerIsEmbedded | ( | const QString & | id | ) | const |
Returns the source project file path if the layer with matching id is embedded from other project file.
Returns an empty string if the matching layer is not embedded.
Definition at line 3866 of file qgsproject.cpp.
|
signal |
Emitted when a layer from a projects was read.
i | current layer |
n | number of layers |
|
signal |
Emitted after a layer was removed from the registry.
layerId | The ID of the layer removed. |
|
inline |
Returns a list of registered map layers with a specified layer type.
QVector<QgsVectorLayer*> vectorLayers = QgsProject::instance()->layers<QgsVectorLayer*>();
Definition at line 1259 of file qgsproject.h.
|
signal |
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.
layers | List of layers which have been added. |
|
signal |
Emitted after one or more layers were removed from the registry.
layerIds | A list of IDs of the layers which were removed. |
QgsMapLayerStore * QgsProject::layerStore | ( | ) |
Returns a pointer to the project's internal layer store.
Definition at line 2760 of file qgsproject.cpp.
const QgsMapLayerStore * QgsProject::layerStore | ( | ) | const |
Returns a pointer to the project's internal layer store.
Definition at line 2768 of file qgsproject.cpp.
|
signal |
Emitted when one or more layers are about to be removed from the registry.
layers | A list of layers which are to be removed. |
|
signal |
Emitted when one or more layers are about to be removed from the registry.
layerIds | A list of IDs for the layers which are to be removed. |
|
inline |
Returns pointer to the helper class that synchronizes map layer registry with layer tree.
Definition at line 984 of file qgsproject.h.
QgsLayerTree * QgsProject::layerTreeRoot | ( | ) | const |
Returns pointer to the root (invisible) node of the project's layer tree.
Definition at line 4339 of file qgsproject.cpp.
|
signal |
Emitted when a layer was added to the registry.
|
signal |
Emitted when a layer is about to be removed from the registry.
layerId | The ID of the layer to be removed. |
|
signal |
Emitted when a layer is about to be removed from the registry.
layer | The layer to be removed. |
QgsLayoutManager * QgsProject::layoutManager | ( | ) |
Returns the project's layout manager, which manages print layouts, atlases and reports within the project.
Definition at line 4205 of file qgsproject.cpp.
const QgsLayoutManager * QgsProject::layoutManager | ( | ) | const |
Returns the project's layout manager, which manages print layouts, atlases and reports within the project.
Definition at line 4198 of file qgsproject.cpp.
|
signal |
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.
layers | List of QgsMapLayer which were added to the legend. |
|
signal |
Emitted when a layer is loaded.
|
signal |
Emitted when loading layers has produced some messages.
layerName | the layer name |
messages | a list of pairs of Qgis::MessageLevel and messages |
QgsAnnotationLayer * QgsProject::mainAnnotationLayer | ( | ) |
Returns the main annotation layer associated with the project.
This layer is always present in projects, and will always be rendered above any other map layers during map render jobs.
It forms the default location to place new annotation items which should appear above all map layers.
Definition at line 4804 of file qgsproject.cpp.
QgsMapLayer * QgsProject::mapLayer | ( | const QString & | layerId | ) | const |
Retrieve a pointer to a registered layer by layer ID.
layerId | ID of layer to retrieve |
nullptr
if no matching layer found Definition at line 4507 of file qgsproject.cpp.
|
inline |
Retrieve a pointer to a registered layer by layerId
converted to type T.
This is a convenience template. A nullptr
will be returned if the layer is not found or if it cannot be cast to type T.
Definition at line 1204 of file qgsproject.h.
QMap< QString, QgsMapLayer * > QgsProject::mapLayers | ( | const bool | validOnly = false | ) | const |
Returns a map of all registered layers by layer ID.
validOnly | if set only valid layers will be returned |
Definition at line 4840 of file qgsproject.cpp.
QList< QgsMapLayer * > QgsProject::mapLayersByName | ( | const QString & | layerName | ) | const |
Retrieve a list of matching registered layers by layer name.
layerName | name of layers to match |
Definition at line 4515 of file qgsproject.cpp.
QList< QgsMapLayer * > QgsProject::mapLayersByShortName | ( | const QString & | shortName | ) | const |
Retrieves a list of matching registered layers by layer shortName.
If layer's short name is empty a match with layer's name is attempted.
Definition at line 4522 of file qgsproject.cpp.
|
inline |
Retrieves a list of matching registered layers by layer shortName with a specified layer type, if layer's short name is empty a match with layer's name is attempted.
shortName | short name of layers to match |
Definition at line 1276 of file qgsproject.h.
QVector< double > QgsProject::mapScales | ( | ) | const |
Returns the list of custom project map scales.
The scales list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.
Definition at line 5142 of file qgsproject.cpp.
|
signal |
Emitted when the list of custom project map scales changes.
QgsMapThemeCollection * QgsProject::mapThemeCollection | ( | ) |
Returns pointer to the project's map theme collection.
|
signal |
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.
const QgsProjectMetadata & QgsProject::metadata | ( | ) | const |
Returns a reference to the project's metadata store.
Definition at line 5020 of file qgsproject.cpp.
|
signal |
|
signal |
Emitted when datum transforms stored in the project are not available locally.
QStringList QgsProject::nonIdentifiableLayers | ( | ) | const |
Gets the list of layers which currently should not be taken into account on map identification.
Definition at line 4405 of file qgsproject.cpp.
|
signal |
Emitted when the list of layer which are excluded from map identification changes.
|
signal |
Emitted when an old project file is read.
QString QgsProject::originalPath | ( | ) | const |
Returns the original path associated with the project.
This is intended for use with non-qgs/qgz project files (see QgsCustomProjectOpenHandler) in order to allow custom project open handlers to specify the original file name of the project. For custom project formats, it is NOT appropriate to call setFileName() with the original project path, as this causes the original (non QGIS) project file to be overwritten when the project is next saved.
Definition at line 831 of file qgsproject.cpp.
QgsPathResolver QgsProject::pathResolver | ( | ) | const |
Returns path resolver object with considering whether the project uses absolute or relative paths and using current project's path.
Definition at line 3793 of file qgsproject.cpp.
QString QgsProject::presetHomePath | ( | ) | const |
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.
Definition at line 4183 of file qgsproject.cpp.
|
signal |
Emitted whenever the project's color scheme has been changed.
|
signal |
Emitted when the project file has been written and closed.
QgsProjectStorage * QgsProject::projectStorage | ( | ) | const |
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 nullptr
. The project storage object is inferred from fileName() of the project.
Definition at line 845 of file qgsproject.cpp.
bool QgsProject::read | ( | const QString & | filename, |
Qgis::ProjectReadFlags | flags = Qgis::ProjectReadFlags() |
||
) |
Reads given project file from the given file.
filename | name of project file to read |
flags | optional flags which control the read behavior of projects |
true
if project file has been read successfully Definition at line 1929 of file qgsproject.cpp.
bool QgsProject::read | ( | Qgis::ProjectReadFlags | flags = Qgis::ProjectReadFlags() | ) |
Reads the project from its currently associated file (see fileName() ).
The flags argument can be used to specify optional flags which control the read behavior of projects.
true
if project file has been read successfully Definition at line 1940 of file qgsproject.cpp.
bool QgsProject::readBoolEntry | ( | const QString & | scope, |
const QString & | key, | ||
bool | def = false , |
||
bool * | ok = nullptr |
||
) | const |
Reads a boolean from the specified scope and key.
scope | entry scope (group) name |
key | entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values. |
def | default value to return if the specified key does not exist within the scope. |
ok | set to true if key exists and has been successfully retrieved as a boolean |
Definition at line 3711 of file qgsproject.cpp.
double QgsProject::readDoubleEntry | ( | const QString & | scope, |
const QString & | key, | ||
double | def = 0 , |
||
bool * | ok = nullptr |
||
) | const |
Reads a double from the specified scope and key.
scope | entry scope (group) name |
key | entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values. |
def | default value to return if the specified key does not exist within the scope. |
ok | set to true if key exists and has been successfully retrieved as a double |
Definition at line 3687 of file qgsproject.cpp.
QString QgsProject::readEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QString & | def = QString() , |
||
bool * | ok = nullptr |
||
) | const |
Reads a string from the specified scope and key.
scope | entry scope (group) name |
key | entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values. |
def | default value to return if the specified key does not exist within the scope. |
ok | set to true if key exists and has been successfully retrieved as a string value |
Definition at line 3630 of file qgsproject.cpp.
bool QgsProject::readLayer | ( | const QDomNode & | layerNode | ) |
Reads the layer described in the associated DOM node.
layerNode | represents a QgsProject DOM node that encodes a specific layer. |
Definition at line 3054 of file qgsproject.cpp.
QStringList QgsProject::readListEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QStringList & | def = QStringList() , |
||
bool * | ok = nullptr |
||
) | const |
Reads a string list from the specified scope and key.
scope | entry scope (group) name |
key | entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values. |
def | default value to return if the specified key does not exist within the scope. |
ok | set to true if key exists and has been successfully retrieved as a string list |
Definition at line 3598 of file qgsproject.cpp.
|
signal |
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.
mapLayer | The map layer which is being initialized |
layerNode | The layer node from the project file |
int QgsProject::readNumEntry | ( | const QString & | scope, |
const QString & | key, | ||
int | def = 0 , |
||
bool * | ok = nullptr |
||
) | const |
Reads an integer from the specified scope and key.
scope | entry scope (group) name |
key | entry key name. Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values. |
def | default value to return if the specified key does not exist within the scope. |
ok | set to true if key exists and has been successfully retrieved as an integer |
Definition at line 3658 of file qgsproject.cpp.
QString QgsProject::readPath | ( | const QString & | filename | ) | const |
Transforms a filename read from the project file to an absolute path.
Definition at line 3823 of file qgsproject.cpp.
|
signal |
Emitted when a project is being read.
|
signal |
Emitted when a project is being read.
And passing the /a context
|
signal |
Emitted when a project is read and the version of QGIS used to save the project differs from the current QGIS version.
The fileVersion argument indicates the version of QGIS used to save the project.
|
slot |
Registers the containers that require translation into the translationContext.
This is a recursive function to get all the child containers.
translationContext | where the objects will be registered |
parent | parent-container containing list of children |
layerId | to store under the correct context |
Definition at line 632 of file qgsproject.cpp.
|
slot |
Registers the objects that require translation into the translationContext.
So there can be created a ts file with these values.
Definition at line 652 of file qgsproject.cpp.
QgsRelationManager * QgsProject::relationManager | ( | ) | const |
Definition at line 4190 of file qgsproject.cpp.
void QgsProject::reloadAllLayers | ( | ) |
Reload all registered layer's provider data caches, synchronising the layer with any changes in the datasource.
Definition at line 4828 of file qgsproject.cpp.
|
signal |
Emitted when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals are emitted.
The layersWillBeRemoved() and layerWillBeRemoved() signals will still be emitted following this signal. You can use this signal to do easy (and fast) cleanup.
void QgsProject::removeAllMapLayers | ( | ) |
Removes all registered layers.
If the registry has ownership of any layers these layers will also be deleted.
Definition at line 4811 of file qgsproject.cpp.
bool QgsProject::removeAttachedFile | ( | const QString & | path | ) |
Removes the attached file.
path | Path to the attached file |
Definition at line 4995 of file qgsproject.cpp.
bool QgsProject::removeEntry | ( | const QString & | scope, |
const QString & | key | ||
) |
Remove the given key from the specified scope.
Definition at line 3735 of file qgsproject.cpp.
void QgsProject::removeMapLayer | ( | const QString & | layerId | ) |
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.
layerId | ID of the layer to remove |
Definition at line 4778 of file qgsproject.cpp.
void QgsProject::removeMapLayer | ( | QgsMapLayer * | layer | ) |
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.
layer | The layer to remove. nullptr values are ignored. |
Definition at line 4787 of file qgsproject.cpp.
void QgsProject::removeMapLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Remove a set of layers from the registry.
The specified layers will be removed from the registry. If the registry has ownership of any layers these layers will also be deleted.
layers | A list of layers to remove. nullptr values are ignored. |
Definition at line 4767 of file qgsproject.cpp.
void QgsProject::removeMapLayers | ( | const QStringList & | layerIds | ) |
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.
layerIds | list of IDs of the layers to remove |
Definition at line 4756 of file qgsproject.cpp.
QSet< QgsMapLayer * > QgsProject::requiredLayers | ( | ) | const |
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.
Definition at line 5043 of file qgsproject.cpp.
QString QgsProject::resolveAttachmentIdentifier | ( | const QString & | identifier | ) | const |
Resolves an attachment identifier to a attachment file path.
identifier | An attachment identifier |
Definition at line 5009 of file qgsproject.cpp.
|
slot |
Stops a current editing operation on vectorLayer and discards any uncommitted edits.
rollbackErrors | will be set to a list of descriptive errors if the rollback fails. |
stopEditing | if set to false , the layer will stay in editing mode. Otherwise the layer editing mode will be disabled if the rollback is successful. |
vectorLayer | for which the changes will be rolled back. For buffered transactions this parameter is not mandatory, as the changes from all layers will be rolled back. |
true
if the rollback was successful.Definition at line 768 of file qgsproject.cpp.
QString QgsProject::saveUser | ( | ) | const |
Returns the user name that did the last save.
Definition at line 564 of file qgsproject.cpp.
QString QgsProject::saveUserFullName | ( | ) | const |
Returns the full user name that did the last save.
Definition at line 571 of file qgsproject.cpp.
QColor QgsProject::selectionColor | ( | ) | const |
Returns the color used to highlight selected features.
Definition at line 5128 of file qgsproject.cpp.
|
signal |
Emitted whenever the project's selection color has been changed.
QgsSensorManager * QgsProject::sensorManager | ( | ) |
Returns the project's sensor manager, which manages sensors within the project.
Definition at line 4247 of file qgsproject.cpp.
const QgsSensorManager * QgsProject::sensorManager | ( | ) | const |
Returns the project's sensor manager, which manages sensors within the project.
Definition at line 4240 of file qgsproject.cpp.
void QgsProject::setAreaUnits | ( | Qgis::AreaUnit | unit | ) |
Sets the default area measurement units for the project.
Definition at line 4116 of file qgsproject.cpp.
void QgsProject::setAutoTransaction | ( | bool | autoTransaction | ) |
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.
Definition at line 4429 of file qgsproject.cpp.
void QgsProject::setAvoidIntersectionsLayers | ( | const QList< QgsVectorLayer * > & | layers | ) |
Sets the list of layers with which intersections should be avoided.
Only used if the avoid intersection mode is set to advanced.
Definition at line 2790 of file qgsproject.cpp.
void QgsProject::setAvoidIntersectionsMode | ( | const Qgis::AvoidIntersectionsMode | mode | ) |
void QgsProject::setBackgroundColor | ( | const QColor & | color | ) |
Sets the default background color used by default map canvases.
Definition at line 5099 of file qgsproject.cpp.
void QgsProject::setBadLayerHandler | ( | QgsProjectBadLayerHandler * | handler | ) |
Change handler for missing layers.
Deletes old handler and takes ownership of the new one.
Definition at line 3858 of file qgsproject.cpp.
void QgsProject::setCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
bool | adjustEllipsoid = false |
||
) |
Sets the project's native coordinate reference system.
If adjustEllipsoid is set to true
, the ellipsoid of this project will be set to the ellipsoid imposed by the CRS.
Changing the CRS will trigger a crsChanged() signal. Additionally, if crs is a compound CRS, then the verticalCrsChanged() signal will also be emitted.
Definition at line 951 of file qgsproject.cpp.
void QgsProject::setCustomVariables | ( | const QVariantMap & | customVariables | ) |
A map of custom project variables.
Be careful not to set generated variables.
Definition at line 2718 of file qgsproject.cpp.
|
slot |
Sets the data defined properties used for overrides in user defined server parameters to properties.
Definition at line 707 of file qgsproject.cpp.
|
slot |
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.
Definition at line 599 of file qgsproject.cpp.
void QgsProject::setDistanceUnits | ( | Qgis::DistanceUnit | unit | ) |
Sets the default distance measurement units for the project.
Definition at line 4104 of file qgsproject.cpp.
void QgsProject::setElevationShadingRenderer | ( | const QgsElevationShadingRenderer & | elevationShadingRenderer | ) |
Sets the elevation shading renderer used for global map shading.
Definition at line 4945 of file qgsproject.cpp.
void QgsProject::setEllipsoid | ( | const QString & | ellipsoid | ) |
Sets the project's ellipsoid from a proj string representation, e.g., "WGS84".
Definition at line 994 of file qgsproject.cpp.
void QgsProject::setEvaluateDefaultValues | ( | bool | evaluateDefaultValues | ) |
Defines if default values should be evaluated on provider side when requested and not when committed.
Definition at line 4082 of file qgsproject.cpp.
void QgsProject::setFileName | ( | const QString & | name | ) |
Sets the file name associated with the project.
This is the file or the storage URI which contains the project's XML representation.
name | project file name |
Definition at line 794 of file qgsproject.cpp.
void QgsProject::setFilePathStorage | ( | Qgis::FilePathType | type | ) |
Sets the type of paths used when storing file paths in a QGS/QGZ project file.
Definition at line 921 of file qgsproject.cpp.
void QgsProject::setFlag | ( | Qgis::ProjectFlag | flag, |
bool | enabled = true |
||
) |
Sets whether a project flag is enabled.
Definition at line 552 of file qgsproject.cpp.
void QgsProject::setFlags | ( | Qgis::ProjectFlags | flags | ) |
Sets the project's flags, which dictate the behavior of the project.
Definition at line 514 of file qgsproject.cpp.
|
static |
Set the current project singleton instance to project.
Definition at line 475 of file qgsproject.cpp.
void QgsProject::setLabelingEngineSettings | ( | const QgsLabelingEngineSettings & | settings | ) |
Sets project's global labeling engine settings.
Definition at line 2745 of file qgsproject.cpp.
void QgsProject::setMapScales | ( | const QVector< double > & | scales | ) |
Sets the list of custom project map scales.
The scales list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.
Definition at line 5135 of file qgsproject.cpp.
void QgsProject::setMetadata | ( | const QgsProjectMetadata & | metadata | ) |
Sets the project's metadata store.
Definition at line 5028 of file qgsproject.cpp.
void QgsProject::setNonIdentifiableLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Set a list of layers which should not be taken into account on map identification.
Definition at line 4367 of file qgsproject.cpp.
void QgsProject::setNonIdentifiableLayers | ( | const QStringList & | layerIds | ) |
Set a list of layers which should not be taken into account on map identification.
Definition at line 4388 of file qgsproject.cpp.
void QgsProject::setOriginalPath | ( | const QString & | path | ) |
Sets the original path associated with the project.
This is intended for use with non-qgs/qgz project files (see QgsCustomProjectOpenHandler) in order to allow custom project open handlers to specify the original file name of the project. For custom project formats, it is NOT appropriate to call setFileName() with the original project path, as this causes the original (non QGIS) project file to be overwritten when the project is next saved.
Definition at line 824 of file qgsproject.cpp.
|
slot |
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.
Definition at line 616 of file qgsproject.cpp.
void QgsProject::setProjectColors | ( | const QgsNamedColorList & | colors | ) |
Sets the colors for the project's color scheme (see QgsProjectColorScheme).
Definition at line 5077 of file qgsproject.cpp.
void QgsProject::setRequiredLayers | ( | const QSet< QgsMapLayer * > & | layers | ) |
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.
Definition at line 5060 of file qgsproject.cpp.
void QgsProject::setSelectionColor | ( | const QColor & | color | ) |
Sets the color used to highlight selected features.
Definition at line 5117 of file qgsproject.cpp.
|
slot |
The snapping configuration for this project.
Definition at line 1445 of file qgsproject.cpp.
void QgsProject::setTitle | ( | const QString & | title | ) |
Sets the project's title.
title | new title |
Definition at line 492 of file qgsproject.cpp.
void QgsProject::setTopologicalEditing | ( | bool | enabled | ) |
Convenience function to set topological editing.
Definition at line 4089 of file qgsproject.cpp.
bool QgsProject::setTransactionMode | ( | Qgis::TransactionMode | transactionMode | ) |
Set transaction mode.
true
if the transaction mode could be changedDefinition at line 4456 of file qgsproject.cpp.
void QgsProject::setTransformContext | ( | const QgsCoordinateTransformContext & | context | ) |
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.
Definition at line 1144 of file qgsproject.cpp.
void QgsProject::setTrustLayerMetadata | ( | bool | trust | ) |
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.
trust | true to trust the project, false otherwise |
Definition at line 4886 of file qgsproject.cpp.
void QgsProject::setUseProjectScales | ( | bool | enabled | ) |
Sets whether project mapScales() are enabled.
Definition at line 5149 of file qgsproject.cpp.
bool QgsProject::setVerticalCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
QString * | errorMessage = nullptr |
||
) |
Sets the project's vertical coordinate reference system.
The verticalCrsChanged() signal will be raised if the vertical CRS is changed.
crs | the vertical CRS |
errorMessage | will be set to a descriptive message if the vertical CRS could not be set |
true
if vertical CRS was successfully setDefinition at line 1036 of file qgsproject.cpp.
QgsSnappingConfig QgsProject::snappingConfig | ( | ) | const |
The snapping configuration for this project.
Definition at line 1438 of file qgsproject.cpp.
|
signal |
Emitted whenever the configuration for snapping has changed.
|
slot |
Makes the layer editable.
This starts an edit session on vectorLayer. Changes made in this edit session will not be made persistent until commitChanges() is called, and can be reverted by calling rollBack().
true
if the layer was successfully made editable, or false
if the operation failed (e.g. due to an underlying read-only data source, or lack of edit support by the backend data provider).Definition at line 721 of file qgsproject.cpp.
QgsProjectStyleSettings * QgsProject::styleSettings | ( | ) |
Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling.
(e.g. styling of a newly added vector layer)
Definition at line 4275 of file qgsproject.cpp.
const QgsProjectStyleSettings * QgsProject::styleSettings | ( | ) | const |
Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling.
(e.g. styling of a newly added vector layer)
Definition at line 4268 of file qgsproject.cpp.
QStringList QgsProject::subkeyList | ( | const QString & | scope, |
const QString & | key | ||
) | const |
Returns a list of child keys which contain other keys that exist within the the specified scope and key.
This method only returns keys with keys, it will not return keys that contain only values. See entryList() to retrieve keys with values.
Definition at line 3767 of file qgsproject.cpp.
QgsMapLayer * QgsProject::takeMapLayer | ( | QgsMapLayer * | layer | ) |
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.
Definition at line 4796 of file qgsproject.cpp.
QgsProjectTimeSettings * QgsProject::timeSettings | ( | ) |
Returns the project's time settings, which contains the project's temporal range and other time based settings.
Definition at line 4290 of file qgsproject.cpp.
const QgsProjectTimeSettings * QgsProject::timeSettings | ( | ) | const |
Returns the project's time settings, which contains the project's temporal range and other time based settings.
Definition at line 4283 of file qgsproject.cpp.
QString QgsProject::title | ( | ) | const |
Returns the project's title.
Definition at line 506 of file qgsproject.cpp.
bool QgsProject::topologicalEditing | ( | ) | const |
Convenience function to query topological editing status.
Definition at line 4097 of file qgsproject.cpp.
|
signal |
Emitted when the topological editing flag has changed.
QgsTransactionGroup * QgsProject::transactionGroup | ( | const QString & | providerKey, |
const QString & | connString | ||
) |
Returns the matching transaction group from a provider key and connection string.
Returns nullptr
if a matching transaction group is not available.
Definition at line 4848 of file qgsproject.cpp.
QMap< QPair< QString, QString >, QgsTransactionGroup * > QgsProject::transactionGroups | ( | ) |
Map of transaction groups.
QPair( providerKey, connString ) -> transactionGroup
Definition at line 4480 of file qgsproject.cpp.
|
signal |
Emitted whenever a new transaction group has been created or a transaction group has been removed.
Qgis::TransactionMode QgsProject::transactionMode | ( | ) | const |
Returns the transaction mode.
Definition at line 4449 of file qgsproject.cpp.
|
signal |
Emitted when the transaction mode has changed.
QgsCoordinateTransformContext QgsProject::transformContext | ( | ) | const |
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.
Definition at line 1136 of file qgsproject.cpp.
|
signal |
Emitted when the project transformContext() is changed.
|
overridevirtual |
Translates the project with QTranslator and qm file.
context | describing layer etc. |
sourceText | is the identifier of this text |
disambiguation | it's the disambiguation |
n | if -1 uses the appropriate form |
Implements QgsProjectTranslator.
Definition at line 5176 of file qgsproject.cpp.
bool QgsProject::trustLayerMetadata | ( | ) | const |
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.
Definition at line 4893 of file qgsproject.cpp.
bool QgsProject::useProjectScales | ( | ) | const |
Returns true
if project mapScales() are enabled.
Definition at line 5156 of file qgsproject.cpp.
int QgsProject::validCount | ( | ) | const |
Returns the number of registered valid layers.
Definition at line 4500 of file qgsproject.cpp.
QgsCoordinateReferenceSystem QgsProject::verticalCrs | ( | ) | const |
Returns the project's vertical coordinate reference system.
If the project crs() is a compound CRS, then the CRS returned will be the vertical component of crs(). Otherwise it will be the value explicitly set by a call to setVerticalCrs().
The returned CRS will be invalid if the project has no vertical CRS.
Definition at line 1006 of file qgsproject.cpp.
|
signal |
Emitted when the verticalCrs() of the project has changed.
This signal will be emitted whenever the vertical CRS of the project is changed, either as a direct result of a call to setVerticalCrs() or when setCrs() is called with a compound CRS.
QgsProjectViewSettings * QgsProject::viewSettings | ( | ) |
Returns the project's view settings, which contains settings and properties relating to how a QgsProject should be viewed and behave inside a map canvas (e.g.
map scales and default view extent)
Definition at line 4261 of file qgsproject.cpp.
const QgsProjectViewSettings * QgsProject::viewSettings | ( | ) | const |
Returns the project's view settings, which contains settings and properties relating to how a QgsProject should be viewed and behave inside a map canvas (e.g.
map scales and default view extent)
Definition at line 4254 of file qgsproject.cpp.
QgsMapViewsManager * QgsProject::viewsManager | ( | ) |
Returns the project's views manager, which manages map views (including 3d maps) in the project.
Definition at line 4219 of file qgsproject.cpp.
const QgsMapViewsManager * QgsProject::viewsManager | ( | ) | const |
Returns the project's views manager, which manages map views (including 3d maps) in the project.
Definition at line 4212 of file qgsproject.cpp.
bool QgsProject::write | ( | ) |
Writes the project to its current associated file (see fileName() ).
true
if project was written successfully false
if project is successfully written Definition at line 3093 of file qgsproject.cpp.
bool QgsProject::write | ( | const QString & | filename | ) |
Writes the project to a file.
filename | destination file |
true
if project was written successfully false
if project is successfully written Definition at line 3084 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
bool | value | ||
) |
Write a boolean value to the project file.
Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 3533 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QString & | value | ||
) |
Write a string value to the project file.
Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 3572 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QStringList & | value | ||
) |
Write a string list value to the project file.
Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 3585 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
double | value | ||
) |
Write a double value to the project file.
Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 3546 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
int | value | ||
) |
Write an integer value to the project file.
Keys are '/'-delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 3559 of file qgsproject.cpp.
|
signal |
Emitted when a layer is being saved.
You can use this method to save additional information to the layer.
mapLayer | The map layer which is being initialized |
layerElem | The layer element from the project file |
doc | The document |
QString QgsProject::writePath | ( | const QString & | filename | ) | const |
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.
Definition at line 3830 of file qgsproject.cpp.
|
signal |
Emitted when the project is being written.
|
friend |
Definition at line 2481 of file qgsproject.h.
|
friend |
Definition at line 2483 of file qgsproject.h.
|
friend |
Definition at line 2486 of file qgsproject.h.
|
friend |
Definition at line 2489 of file qgsproject.h.
|
friend |
Definition at line 2491 of file qgsproject.h.
|
readwrite |
Definition at line 125 of file qgsproject.h.
|
readwrite |
Definition at line 119 of file qgsproject.h.
|
readwrite |
Definition at line 118 of file qgsproject.h.
|
readwrite |
Definition at line 121 of file qgsproject.h.
|
readwrite |
Definition at line 112 of file qgsproject.h.
|
read |
Definition at line 126 of file qgsproject.h.
|
readwrite |
Definition at line 124 of file qgsproject.h.
|
readwrite |
Definition at line 114 of file qgsproject.h.
|
readwrite |
Definition at line 110 of file qgsproject.h.
|
readwrite |
Definition at line 111 of file qgsproject.h.
|
read |
Definition at line 115 of file qgsproject.h.
|
readwrite |
Definition at line 120 of file qgsproject.h.
|
readwrite |
Definition at line 109 of file qgsproject.h.
|
read |
Definition at line 117 of file qgsproject.h.
|
readwrite |
Definition at line 122 of file qgsproject.h.
|
readwrite |
Definition at line 116 of file qgsproject.h.
|
readwrite |
Definition at line 123 of file qgsproject.h.
|
readwrite |
Definition at line 127 of file qgsproject.h.
|
readwrite |
Definition at line 113 of file qgsproject.h.