|
| QgsProject (QObject *parent=nullptr, Qgis::ProjectCapabilities capabilities=Qgis::ProjectCapability::ProjectStyles) |
| Create a new QgsProject. More...
|
|
| ~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(). More...
|
|
QString | absolutePath () const |
| Returns full absolute path to the project folder if the project is stored in a file system - derived from fileName(). More...
|
|
bool | accept (QgsStyleEntityVisitorInterface *visitor) const |
| Accepts the specified style entity visitor, causing it to visit all style entities associated with the project. More...
|
|
QgsMapLayer * | addMapLayer (QgsMapLayer *mapLayer, bool addToLegend=true, bool takeOwnership=true) |
| Add a layer to the map of loaded layers. More...
|
|
QList< QgsMapLayer * > | addMapLayers (const QList< QgsMapLayer * > &mapLayers, bool addToLegend=true, bool takeOwnership=true) |
| Add a list of layers to the map of loaded layers. More...
|
|
QgsAnnotationManager * | annotationManager () |
| Returns pointer to the project's annotation manager. More...
|
|
const QgsAnnotationManager * | annotationManager () const |
| Returns a const pointer to the project's annotation manager. More...
|
|
Qgis::AreaUnit | areaUnits () const |
| Convenience function to query default area measurement units for project. More...
|
|
QStringList | attachedFiles () const |
| Returns a map of all attached files with identifier and real paths. More...
|
|
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. More...
|
|
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. More...
|
|
QgsAuxiliaryStorage * | auxiliaryStorage () |
| Returns the current auxiliary storage. More...
|
|
const QgsAuxiliaryStorage * | auxiliaryStorage () const |
| Returns the current const auxiliary storage. More...
|
|
QList< QgsVectorLayer * > | avoidIntersectionsLayers () const |
| A list of layers with which intersections should be avoided. More...
|
|
Qgis::AvoidIntersectionsMode | avoidIntersectionsMode () const |
| Returns the current avoid intersections mode. More...
|
|
QColor | backgroundColor () const |
| Returns the default background color used by default map canvases. More...
|
|
QString | baseName () const |
| Returns the base name of the project file without the path and without extension - derived from fileName(). More...
|
|
QgsBookmarkManager * | bookmarkManager () |
| Returns the project's bookmark manager, which manages bookmarks within the project. More...
|
|
const QgsBookmarkManager * | bookmarkManager () const |
| Returns the project's bookmark manager, which manages bookmarks within the project. More...
|
|
Qgis::ProjectCapabilities | capabilities () const |
| Returns the project's capabilities, which dictate optional functionality which can be selectively enabled for a QgsProject object. More...
|
|
void | clear () |
| Clears the project, removing all settings and resetting it back to an empty, default state. More...
|
|
int | count () const |
| Returns the number of registered layers. More...
|
|
QString | createAttachedFile (const QString &nameTemplate) |
| Attaches a file to the project. More...
|
|
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. More...
|
|
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. More...
|
|
QgsExpressionContext | createExpressionContext () const override |
| This method needs to be reimplemented in all classes which implement this interface and return an expression context. More...
|
|
QgsExpressionContextScope * | createExpressionContextScope () const override |
| This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. More...
|
|
QgsCoordinateReferenceSystem | crs () const |
| Returns the project's native coordinate reference system. More...
|
|
QVariantMap | customVariables () const |
| A map of custom project variables. More...
|
|
QgsCoordinateReferenceSystem | defaultCrsForNewLayers () const |
| Returns the default CRS for new layers based on the settings and the current project CRS. More...
|
|
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. More...
|
|
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. More...
|
|
Qgis::DistanceUnit | distanceUnits () const |
| Convenience function to query default distance measurement units for project. More...
|
|
void | dumpProperties () const |
| Dump out current project properties to stderr. More...
|
|
QgsVectorLayerEditBufferGroup * | editBufferGroup () |
| Returns the edit buffer group. More...
|
|
QgsProjectElevationProperties * | elevationProperties () |
| Returns the project's elevation properties, which contains the project's elevation related settings. More...
|
|
const QgsProjectElevationProperties * | elevationProperties () const |
| Returns the project's elevation properties, which contains the project's elevation related settings. More...
|
|
QgsElevationShadingRenderer | elevationShadingRenderer () const |
| Returns the elevation shading renderer used for map shading. More...
|
|
QString | ellipsoid () const |
| Returns a proj string representing the project's ellipsoid setting, e.g., "WGS84". More...
|
|
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. More...
|
|
QString | error () const |
| Returns error message from previous read/write. More...
|
|
Q_DECL_DEPRECATED bool | evaluateDefaultValues () const |
| Should default values be evaluated on provider side when requested and not when committed. More...
|
|
Q_DECL_DEPRECATED QFileInfo | fileInfo () const |
| Returns QFileInfo object for the project's associated file. More...
|
|
QString | fileName () const |
| Returns the project's file name. More...
|
|
Qgis::FilePathType | filePathStorage () const |
| Returns the type of paths used when storing file paths in a QGS/QGZ project file. More...
|
|
Qgis::ProjectFlags | flags () const |
| Returns the project's flags, which dictate the behavior of the project. More...
|
|
void | generateTsFile (const QString &locale) |
| Triggers the collection strings of .qgs to be included in ts file and calls writeTsFile() More...
|
|
QgsProjectGpsSettings * | gpsSettings () |
| Returns the project's GPS settings, which contains settings and properties relating to how a QgsProject should interact with a GPS device. More...
|
|
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. More...
|
|
QString | homePath () const |
| Returns the project's home path. More...
|
|
bool | isDirty () const |
| Returns true if the project has been modified since the last write() More...
|
|
bool | isZipped () const |
| Returns true if the project comes from a zip archive, false otherwise. More...
|
|
const QgsLabelingEngineSettings & | labelingEngineSettings () const |
| Returns project's global labeling engine settings. More...
|
|
QDateTime | lastModified () const |
| Returns last modified time of the project file as returned by the file system (or other project storage). More...
|
|
QDateTime | lastSaveDateTime () const |
| Returns the date and time when the project was last saved. More...
|
|
QgsProjectVersion | lastSaveVersion () const |
| Returns the QGIS version which the project was last saved using. More...
|
|
QString | layerIsEmbedded (const QString &id) const |
| Returns the source project file path if the layer with matching id is embedded from other project file. More...
|
|
template<typename T > |
QVector< T > | layers () const |
| Returns a list of registered map layers with a specified layer type. More...
|
|
QgsMapLayerStore * | layerStore () |
| Returns a pointer to the project's internal layer store. More...
|
|
const QgsMapLayerStore * | layerStore () const |
| Returns a pointer to the project's internal layer store. More...
|
|
QgsLayerTreeRegistryBridge * | layerTreeRegistryBridge () const |
| Returns pointer to the helper class that synchronizes map layer registry with layer tree. More...
|
|
QgsLayerTree * | layerTreeRoot () const |
| Returns pointer to the root (invisible) node of the project's layer tree. More...
|
|
QgsLayoutManager * | layoutManager () |
| Returns the project's layout manager, which manages print layouts, atlases and reports within the project. More...
|
|
const QgsLayoutManager * | layoutManager () const |
| Returns the project's layout manager, which manages print layouts, atlases and reports within the project. More...
|
|
QgsAnnotationLayer * | mainAnnotationLayer () |
| Returns the main annotation layer associated with the project. More...
|
|
Q_INVOKABLE QgsMapLayer * | mapLayer (const QString &layerId) const |
| Retrieve a pointer to a registered layer by layer ID. More...
|
|
template<class T > |
T | mapLayer (const QString &layerId) const |
| Retrieve a pointer to a registered layer by layerId converted to type T. More...
|
|
QMap< QString, QgsMapLayer * > | mapLayers (const bool validOnly=false) const |
| Returns a map of all registered layers by layer ID. More...
|
|
QList< QgsMapLayer * > | mapLayersByName (const QString &layerName) const |
| Retrieve a list of matching registered layers by layer name. More...
|
|
QList< QgsMapLayer * > | mapLayersByShortName (const QString &shortName) const |
| Retrieves a list of matching registered layers by layer shortName. More...
|
|
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. More...
|
|
Q_DECL_DEPRECATED QVector< double > | mapScales () const |
| Returns the list of custom project map scales. More...
|
|
QgsMapThemeCollection * | mapThemeCollection () |
| Returns pointer to the project's map theme collection. More...
|
|
const QgsProjectMetadata & | metadata () const |
| Returns a reference to the project's metadata store. More...
|
|
Q_DECL_DEPRECATED QStringList | nonIdentifiableLayers () const |
| Gets the list of layers which currently should not be taken into account on map identification. More...
|
|
QString | originalPath () const |
| Returns the original path associated with the project. More...
|
|
QgsPathResolver | pathResolver () const |
| Returns path resolver object with considering whether the project uses absolute or relative paths and using current project's path. More...
|
|
QString | presetHomePath () const |
| Returns any manual project home path setting, or an empty string if not set. More...
|
|
QgsProjectStorage * | projectStorage () const |
| Returns pointer to project storage implementation that handles read/write of the project file. More...
|
|
bool | read (const QString &filename, Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
| Reads given project file from the given file. More...
|
|
bool | read (Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
| Reads the project from its currently associated file (see fileName() ). More...
|
|
bool | readBoolEntry (const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const |
| Reads a boolean from the specified scope and key. More...
|
|
double | readDoubleEntry (const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const |
| Reads a double from the specified scope and key. More...
|
|
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. More...
|
|
bool | readLayer (const QDomNode &layerNode) |
| Reads the layer described in the associated DOM node. More...
|
|
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. More...
|
|
int | readNumEntry (const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const |
| Reads an integer from the specified scope and key. More...
|
|
QString | readPath (const QString &filename) const |
| Transforms a filename read from the project file to an absolute path. More...
|
|
QgsRelationManager * | relationManager () const |
|
void | reloadAllLayers () |
| Reload all registered layer's provider data caches, synchronising the layer with any changes in the datasource. More...
|
|
void | removeAllMapLayers () |
| Removes all registered layers. More...
|
|
bool | removeAttachedFile (const QString &path) |
| Removes the attached file. More...
|
|
bool | removeEntry (const QString &scope, const QString &key) |
| Remove the given key from the specified scope. More...
|
|
void | removeMapLayer (const QString &layerId) |
| Remove a layer from the registry by layer ID. More...
|
|
void | removeMapLayer (QgsMapLayer *layer) |
| Remove a layer from the registry. More...
|
|
void | removeMapLayers (const QList< QgsMapLayer * > &layers) |
| Remove a set of layers from the registry. More...
|
|
void | removeMapLayers (const QStringList &layerIds) |
| Remove a set of layers from the registry by layer ID. More...
|
|
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. More...
|
|
QString | resolveAttachmentIdentifier (const QString &identifier) const |
| Resolves an attachment identifier to a attachment file path. More...
|
|
QString | saveUser () const |
| Returns the user name that did the last save. More...
|
|
QString | saveUserFullName () const |
| Returns the full user name that did the last save. More...
|
|
QColor | selectionColor () const |
| Returns the color used to highlight selected features. More...
|
|
void | setAreaUnits (Qgis::AreaUnit unit) |
| Sets the default area measurement units for the project. More...
|
|
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. More...
|
|
void | setAvoidIntersectionsLayers (const QList< QgsVectorLayer * > &layers) |
| Sets the list of layers with which intersections should be avoided. More...
|
|
void | setAvoidIntersectionsMode (const Qgis::AvoidIntersectionsMode mode) |
| Sets the avoid intersections mode. More...
|
|
void | setBackgroundColor (const QColor &color) |
| Sets the default background color used by default map canvases. More...
|
|
void | setBadLayerHandler (QgsProjectBadLayerHandler *handler) |
| Change handler for missing layers. More...
|
|
void | setCrs (const QgsCoordinateReferenceSystem &crs, bool adjustEllipsoid=false) |
| Sets the project's native coordinate reference system. More...
|
|
void | setCustomVariables (const QVariantMap &customVariables) |
| A map of custom project variables. More...
|
|
void | setDistanceUnits (Qgis::DistanceUnit unit) |
| Sets the default distance measurement units for the project. More...
|
|
void | setElevationShadingRenderer (const QgsElevationShadingRenderer &elevationShadingRenderer) |
| Sets the elevation shading renderer used for global map shading. More...
|
|
void | setEllipsoid (const QString &ellipsoid) |
| Sets the project's ellipsoid from a proj string representation, e.g., "WGS84". More...
|
|
Q_DECL_DEPRECATED void | setEvaluateDefaultValues (bool evaluateDefaultValues) |
| Defines if default values should be evaluated on provider side when requested and not when committed. More...
|
|
void | setFileName (const QString &name) |
| Sets the file name associated with the project. More...
|
|
void | setFilePathStorage (Qgis::FilePathType type) |
| Sets the type of paths used when storing file paths in a QGS/QGZ project file. More...
|
|
void | setFlag (Qgis::ProjectFlag flag, bool enabled=true) |
| Sets whether a project flag is enabled. More...
|
|
void | setFlags (Qgis::ProjectFlags flags) |
| Sets the project's flags, which dictate the behavior of the project. More...
|
|
void | setLabelingEngineSettings (const QgsLabelingEngineSettings &settings) |
| Sets project's global labeling engine settings. More...
|
|
Q_DECL_DEPRECATED void | setMapScales (const QVector< double > &scales) |
| Sets the list of custom project map scales. More...
|
|
void | setMetadata (const QgsProjectMetadata &metadata) |
| Sets the project's metadata store. More...
|
|
Q_DECL_DEPRECATED void | setNonIdentifiableLayers (const QList< QgsMapLayer * > &layers) |
| Set a list of layers which should not be taken into account on map identification. More...
|
|
Q_DECL_DEPRECATED void | setNonIdentifiableLayers (const QStringList &layerIds) |
| Set a list of layers which should not be taken into account on map identification. More...
|
|
void | setOriginalPath (const QString &path) |
| Sets the original path associated with the project. More...
|
|
void | setProjectColors (const QgsNamedColorList &colors) |
| Sets the colors for the project's color scheme (see QgsProjectColorScheme). More...
|
|
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. More...
|
|
void | setSelectionColor (const QColor &color) |
| Sets the color used to highlight selected features. More...
|
|
void | setTitle (const QString &title) |
| Sets the project's title. More...
|
|
void | setTopologicalEditing (bool enabled) |
| Convenience function to set topological editing. More...
|
|
bool | setTransactionMode (Qgis::TransactionMode transactionMode) |
| Set transaction mode. More...
|
|
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. More...
|
|
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. More...
|
|
Q_DECL_DEPRECATED void | setUseProjectScales (bool enabled) |
| Sets whether project mapScales() are enabled. More...
|
|
QgsSnappingConfig | snappingConfig () const |
| The snapping configuration for this project. More...
|
|
QgsProjectStyleSettings * | styleSettings () |
| Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling. More...
|
|
const QgsProjectStyleSettings * | styleSettings () const |
| Returns the project's style settings, which contains settings and properties relating to how a QgsProject should handle styling. More...
|
|
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. More...
|
|
QgsMapLayer * | takeMapLayer (QgsMapLayer *layer) |
| Takes a layer from the registry. More...
|
|
QgsProjectTimeSettings * | timeSettings () |
| Returns the project's time settings, which contains the project's temporal range and other time based settings. More...
|
|
const QgsProjectTimeSettings * | timeSettings () const |
| Returns the project's time settings, which contains the project's temporal range and other time based settings. More...
|
|
QString | title () const |
| Returns the project's title. More...
|
|
bool | topologicalEditing () const |
| Convenience function to query topological editing status. More...
|
|
QgsTransactionGroup * | transactionGroup (const QString &providerKey, const QString &connString) |
| Returns the matching transaction group from a provider key and connection string. More...
|
|
QMap< QPair< QString, QString >, QgsTransactionGroup * > | transactionGroups () |
| Map of transaction groups. More...
|
|
Qgis::TransactionMode | transactionMode () const |
| Returns the transaction mode. More...
|
|
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. More...
|
|
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. More...
|
|
Q_DECL_DEPRECATED bool | trustLayerMetadata () const |
| Returns true if the trust option is activated, false otherwise. More...
|
|
Q_DECL_DEPRECATED bool | useProjectScales () const |
| Returns true if project mapScales() are enabled. More...
|
|
int | validCount () const |
| Returns the number of registered valid layers. More...
|
|
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. More...
|
|
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. More...
|
|
QgsMapViewsManager * | viewsManager () |
| Returns the project's views manager, which manages map views (including 3d maps) in the project. More...
|
|
const QgsMapViewsManager * | viewsManager () const |
| Returns the project's views manager, which manages map views (including 3d maps) in the project. More...
|
|
bool | write () |
| Writes the project to its current associated file (see fileName() ). More...
|
|
bool | write (const QString &filename) |
| Writes the project to a file. More...
|
|
bool | writeEntry (const QString &scope, const QString &key, bool value) |
| Write a boolean value to the project file. More...
|
|
bool | writeEntry (const QString &scope, const QString &key, const QString &value) |
| Write a string value to the project file. More...
|
|
bool | writeEntry (const QString &scope, const QString &key, const QStringList &value) |
| Write a string list value to the project file. More...
|
|
bool | writeEntry (const QString &scope, const QString &key, double value) |
| Write a double value to the project file. More...
|
|
bool | writeEntry (const QString &scope, const QString &key, int value) |
| Write an integer value to the project file. More...
|
|
QString | writePath (const QString &filename) const |
| Prepare a filename to save it to the project file. More...
|
|
virtual | ~QgsExpressionContextGenerator ()=default |
|
virtual QgsExpressionContext | createExpressionContext () const =0 |
| This method needs to be reimplemented in all classes which implement this interface and return an expression context. More...
|
|
virtual | ~QgsExpressionContextScopeGenerator ()=default |
|
virtual QgsExpressionContextScope * | createExpressionContextScope () const =0 |
| This method needs to be reimplemented in all classes which implement this interface and return an expression context scope. More...
|
|
virtual | ~QgsProjectTranslator ()=default |
|
virtual QString | translate (const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0 |
| The derived translate() translates with QTranslator and qm file the sourceText. More...
|
|