109 Q_PROPERTY( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
110 Q_PROPERTY( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
111 Q_PROPERTY( QString homePath READ homePath WRITE setPresetHomePath NOTIFY homePathChanged )
114 Q_PROPERTY( QString ellipsoid READ ellipsoid WRITE setEllipsoid NOTIFY ellipsoidChanged )
115 Q_PROPERTY(
QgsMapThemeCollection *mapThemeCollection READ mapThemeCollection NOTIFY mapThemeCollectionChanged )
116 Q_PROPERTY(
QgsSnappingConfig snappingConfig READ snappingConfig WRITE setSnappingConfig NOTIFY snappingConfigChanged )
118 Q_PROPERTY(
Qgis::AvoidIntersectionsMode avoidIntersectionsMode READ avoidIntersectionsMode WRITE setAvoidIntersectionsMode NOTIFY avoidIntersectionsModeChanged )
119 Q_PROPERTY( QList<QgsVectorLayer *> avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged )
120 Q_PROPERTY(
QgsProjectMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
121 Q_PROPERTY( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged )
122 Q_PROPERTY( QColor selectionColor READ selectionColor WRITE setSelectionColor NOTIFY selectionColorChanged )
123 Q_PROPERTY(
bool topologicalEditing READ topologicalEditing WRITE setTopologicalEditing NOTIFY topologicalEditingChanged )
124 Q_PROPERTY(
Qgis::DistanceUnit distanceUnits READ distanceUnits WRITE setDistanceUnits NOTIFY distanceUnitsChanged )
125 Q_PROPERTY(
Qgis::AreaUnit areaUnits READ areaUnits WRITE setAreaUnits NOTIFY areaUnitsChanged )
142 WMSOnlineResource = 2,
156 static void setInstance(
QgsProject *project ) ;
179 void setTitle(
const QString &title );
187 QString title()
const;
195 Qgis::ProjectCapabilities
capabilities()
const {
return mCapabilities; }
205 Qgis::ProjectFlags
flags()
const {
return mFlags; }
215 void setFlags( Qgis::ProjectFlags flags );
234 QString saveUser()
const;
243 QString saveUserFullName()
const;
250 QDateTime lastSaveDateTime()
const;
262 bool isDirty()
const;
270 void setFileName(
const QString &name );
278 QString fileName()
const;
291 void setOriginalPath(
const QString &path );
304 QString originalPath()
const;
330 QDateTime lastModified() const;
337 QString absoluteFilePath() const;
344 QString absolutePath() const;
350 QString baseName() const;
358 Qgis::FilePathType filePathStorage() const;
366 void setFilePathStorage(
Qgis::FilePathType type );
393 QString ellipsoid() const;
401 void setEllipsoid( const QString &ellipsoid );
439 bool read( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
449 bool read(
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
460 bool readLayer( const QDomNode &layerNode );
470 bool write( const QString &filename );
490 bool writeEntry( const QString &scope, const QString &key,
bool value )
SIP_PYNAME( writeEntryBool );
503 bool writeEntry( const QString &scope, const QString &key,
double value )
SIP_PYNAME( writeEntryDouble );
515 bool writeEntry( const QString &scope, const QString &key,
int value );
527 bool writeEntry( const QString &scope, const QString &key, const QString &value );
539 bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
551 QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(),
bool *ok
SIP_OUT =
nullptr ) const;
563 QString readEntry( const QString &scope, const QString &key, const QString &def = QString(),
bool *ok
SIP_OUT =
nullptr ) const;
575 int readNumEntry( const QString &scope, const QString &key,
int def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
587 double readDoubleEntry( const QString &scope, const QString &key,
double def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
599 bool readBoolEntry( const QString &scope, const QString &key,
bool def = false,
bool *ok
SIP_OUT =
nullptr ) const;
604 bool removeEntry( const QString &scope, const QString &key );
614 QStringList entryList( const QString &scope, const QString &key ) const;
624 QStringList subkeyList( const QString &scope, const QString &key ) const;
632 void dumpProperties() const;
646 QString writePath( const QString &filename ) const;
651 QString readPath( const QString &filename ) const;
654 QString error() const;
667 QString layerIsEmbedded( const QString &
id ) const;
677 bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
678 bool saveFlag = true,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() )
SIP_SKIP;
687 QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
690 void setTopologicalEditing(
bool enabled );
693 bool topologicalEditing() const;
701 Qgis::DistanceUnit distanceUnits()
const {
return mDistanceUnits; }
738 QString homePath()
const;
752 QString presetHomePath()
const;
947 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QList<
QgsMapLayer *> &layers );
953 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QStringList &layerIds );
959 Q_DECL_DEPRECATED QStringList nonIdentifiableLayers() const;
981 Q_DECL_DEPRECATED
void setAutoTransaction(
bool autoTransaction )
SIP_DEPRECATED;
989 Qgis::TransactionMode transactionMode() const;
1000 bool setTransactionMode(
Qgis::TransactionMode transactionMode );
1019 QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
1033 Q_DECL_DEPRECATED
bool evaluateDefaultValues() const
SIP_DEPRECATED;
1040 Q_DECL_DEPRECATED
void setEvaluateDefaultValues(
bool evaluateDefaultValues )
SIP_DEPRECATED;
1065 void setAvoidIntersectionsLayers( const QList<
QgsVectorLayer *> &layers );
1072 void setAvoidIntersectionsMode( const
Qgis::AvoidIntersectionsMode mode );
1079 Qgis::AvoidIntersectionsMode avoidIntersectionsMode()
const {
return mAvoidIntersectionsMode; }
1086 QVariantMap customVariables()
const;
1092 void setCustomVariables(
const QVariantMap &customVariables );
1126 int validCount()
const;
1135 Q_INVOKABLE
QgsMapLayer *mapLayer(
const QString &layerId )
const;
1157 return qobject_cast<T>( mapLayer( layerId ) );
1168 QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
1179 QList<QgsMapLayer *> mapLayersByShortName(
const QString &shortName )
const;
1190 QMap<QString, QgsMapLayer *> mapLayers(
const bool validOnly =
false )
const;
1195 bool isZipped()
const;
1210 template <
typename T>
1213 return mLayerStore->layers<T>();
1227 template <
typename T>
1231 const auto constMapLayers { mLayerStore->layers<T>() };
1232 for (
const auto l : constMapLayers )
1234 if ( ! l->shortName().isEmpty() )
1236 if ( l->shortName() == shortName )
1239 else if ( l->name() == shortName )
1274 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
1275 bool addToLegend =
true,
1306 bool addToLegend =
true,
1323 void removeMapLayers(
const QStringList &layerIds );
1340 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
1355 void removeMapLayer(
const QString &layerId );
1404 void removeAllMapLayers();
1411 void reloadAllLayers();
1430 Q_DECL_DEPRECATED
void setTrustLayerMetadata(
bool trust )
SIP_DEPRECATED;
1442 Q_DECL_DEPRECATED
bool trustLayerMetadata() const
SIP_DEPRECATED;
1466 QString createAttachedFile( const QString &nameTemplate );
1474 QStringList attachedFiles() const;
1483 bool removeAttachedFile( const QString &path );
1493 QString attachmentIdentifier( const QString &attachedFile ) const;
1501 QString resolveAttachmentIdentifier( const QString &identifier ) const;
1527 Q_DECL_DEPRECATED QSet<
QgsMapLayer *> requiredLayers() const;
1537 Q_DECL_DEPRECATED
void setRequiredLayers( const QSet<
QgsMapLayer *> &layers );
1553 void setBackgroundColor( const QColor &color );
1561 QColor backgroundColor() const;
1569 void setSelectionColor( const QColor &color );
1577 QColor selectionColor() const;
1590 Q_DECL_DEPRECATED
void setMapScales( const QVector<
double> &scales )
SIP_DEPRECATED;
1603 Q_DECL_DEPRECATED QVector<
double> mapScales() const
SIP_DEPRECATED;
1613 Q_DECL_DEPRECATED
void setUseProjectScales(
bool enabled )
SIP_DEPRECATED;
1629 void generateTsFile( const QString &locale );
1641 QString translate( const QString &context, const QString &sourceText, const
char *disambiguation =
nullptr,
int n = -1 ) const override;
1669 SIP_PYOBJECT __repr__();
1671 QString
str = QStringLiteral(
"<QgsProject: '%1'%2>" ).arg( sipCpp->fileName(),
1673 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
2054 void elevationShadingRendererChanged();
2074 void setDirty(
bool b = true );
2084 void setPresetHomePath( const QString &path );
2168 bool commitChanges( QStringList &commitErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2186 bool rollBack( QStringList &rollbackErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2189 void onMapLayersAdded( const QList<
QgsMapLayer *> &layers );
2190 void onMapLayersRemoved( const QList<
QgsMapLayer *> &layers );
2191 void cleanTransactionGroups(
bool force = false );
2192 void updateTransactionGroups();
2207 bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2213 void setError( const QString &errorMessage )
SIP_SKIP;
2230 bool addLayer( const QDomElement &layerElem,
2231 QList<QDomNode> &brokenNodes,
2233 Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags(),
2239 void removeAuxiliaryLayer( const
QgsMapLayer *ml );
2255 bool readProjectFile( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2258 bool writeProjectFile( const QString &filename );
2261 bool unzip( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2264 bool zip( const QString &filename );
2267 bool saveAuxiliaryStorage( const QString &filename = QString() );
2270 void loadProjectFlags( const QDomDocument *doc );
2276 void preloadProviders( const QVector<QDomNode> &asynchronusLayerNodes,
2280 int totalProviderCount );
2286 void releaseHandlesToProjectArchive();
2288 Qgis::ProjectCapabilities mCapabilities;
2292 QString mErrorMessage;
2301 QHash< QString, QPair< QString,
bool> > mEmbeddedLayers;
2304 Qgis::AvoidIntersectionsMode mAvoidIntersectionsMode =
Qgis::AvoidIntersectionsMode::AllowIntersections;
2343 QVariantMap mCustomVariables;
2351 QString mOriginalPath;
2354 QString mSaveUserFull;
2355 QDateTime mSaveDateTime;
2363 mutable QString mCachedHomePath;
2365 QColor mBackgroundColor;
2366 QColor mSelectionColor;
2368 Qgis::DistanceUnit mDistanceUnits =
Qgis::DistanceUnit::Meters;
2369 Qgis::AreaUnit mAreaUnits =
Qgis::AreaUnit::SquareMeters;
2372 Qgis::TransactionMode mTransactionMode =
Qgis::TransactionMode::Disabled;
2374 Qgis::ProjectFlags mFlags;
2376 bool mDirty = false;
2377 int mDirtyBlockCount = 0;
2387 bool mIsBeingDeleted = false;
2393 int mBlockSnappingUpdates = 0;
2407 friend class TestQgsProject;
2443 : mProject( project )
2445 mProject->mDirtyBlockCount++;
2456 mProject->mDirtyBlockCount--;
2481 GetNamedProjectColor(
const QgsProject *project );
2487 GetNamedProjectColor(
const QHash< QString, QColor > &colors );
2494 QHash< QString, QColor > mColors;
2501 GetSensorData(
const QMap<QString, QgsAbstractSensor::SensorData> &sensorData = QMap<QString, QgsAbstractSensor::SensorData>() );
2507 QMap<QString, QgsAbstractSensor::SensorData> mSensorData;
The Qgis class provides global constants for use throughout the application.
DistanceUnit
Units of distance.
@ ProjectStyles
Enable the project embedded style library. Enabling this flag can increase the time required to clear...
AvoidIntersectionsMode
Flags which control how intersections of pre-existing feature are handled when digitizing new feature...
ProjectFlag
Flags which control the behavior of QgsProjects.
Represents a map layer containing a set of georeferenced annotations, e.g.
Manages storage of a set of QgsAnnotation annotation objects.
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
Class allowing to manage the zip/unzip actions.
This is a container for attribute editors, used to group them visually in the attribute form if it is...
Class providing some utility methods to manage auxiliary storage.
Manages storage of a set of bookmarks.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Abstract base class for spatial data provider implementations.
This class can render elevation shading on an image with different methods (eye dome lighting,...
Abstract interface for generating an expression context.
Abstract interface for generating an expression context scope.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
An expression node for expression functions.
Class for parsing and evaluation of expressions (formerly called "search strings").
Stores global configuration for labeling engine.
Layer tree group node serves as a container for layers and further groups.
Listens to the updates in map layer registry and does changes in layer tree.
Namespace with helper functions for layer tree operations.
Manages storage of a set of layouts.
A storage object for map layers, in which the layers are owned by the store and have their lifetime b...
Base class for all map layer types.
Container class that allows storage of map themes consisting of visible map layers and layer styles.
Manages storage of a set of views.
Resolves relative paths into absolute paths and vice versa.
Interface for classes that handle missing layer files when reading project file.
Temporarily blocks QgsProject "dirtying" for the lifetime of the object.
QgsProjectDirtyBlocker & operator=(const QgsProjectDirtyBlocker &other)=delete
QgsProjectDirtyBlocker cannot be copied.
QgsProjectDirtyBlocker(QgsProject *project)
Constructor for QgsProjectDirtyBlocker.
~QgsProjectDirtyBlocker()
QgsProjectDirtyBlocker(const QgsProjectDirtyBlocker &other)=delete
QgsProjectDirtyBlocker cannot be copied.
Contains settings and properties relating to how a QgsProject should display values such as map coord...
Contains elevation properties for a QgsProject.
Contains settings and properties relating to how a QgsProject should interact with a GPS device.
Project property key node.
Abstract interface for project storage - to be implemented by various backends and registered in QgsP...
Contains settings and properties relating to how a QgsProject should handle styling.
Contains temporal settings and properties for the project, this may be used when animating maps or sh...
Wherever an object of this class is available, the derived translate function can be called from.
A class to describe the version of a project.
Contains settings and properties relating to how a QgsProject should be displayed inside map canvas,...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
void layersRemoved(const QStringList &layerIds)
Emitted after one or more layers were removed from the registry.
Qgis::ProjectFlags flags() const
Returns the project's flags, which dictate the behavior of the project.
void mapThemeCollectionChanged()
Emitted when the map theme collection changes.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Q_DECL_DEPRECATED void mapScalesChanged()
Emitted when the list of custom project map scales changes.
void readVersionMismatchOccurred(const QString &fileVersion)
Emitted when a project is read and the version of QGIS used to save the project differs from the curr...
void fileNameChanged()
Emitted when the file name of the project changes.
void writeMapLayer(QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc)
Emitted when a layer is being saved.
void areaUnitsChanged()
Emitted when the default area units changes.
Q_DECL_DEPRECATED void nonIdentifiableLayersChanged(QStringList nonIdentifiableLayers)
Emitted when the list of layer which are excluded from map identification changes.
void layersWillBeRemoved(const QStringList &layerIds)
Emitted when one or more layers are about to be removed from the registry.
void snappingConfigChanged(const QgsSnappingConfig &config)
Emitted whenever the configuration for snapping has changed.
void layerWasAdded(QgsMapLayer *layer)
Emitted when a layer was added to the registry.
void crsChanged()
Emitted when the CRS of the project has changed.
Qgis::AreaUnit areaUnits() const
Convenience function to query default area measurement units for project.
void avoidIntersectionsLayersChanged()
Emitted whenever avoidIntersectionsLayers has changed.
void layerWillBeRemoved(const QString &layerId)
Emitted when a layer is about to be removed from the registry.
void distanceUnitsChanged()
Emitted when the default distance units changes.
void readMapLayer(QgsMapLayer *mapLayer, const QDomElement &layerNode)
Emitted after the basic initialization of a layer from the project file is done.
void cleared()
Emitted when the project is cleared (and additionally when an open project is cleared just before a n...
DataDefinedServerProperty
Data defined properties.
Q_DECL_DEPRECATED void oldProjectVersionWarning(const QString &)
Emitted when an old project file is read.
void metadataChanged()
Emitted when the project's metadata is changed.
void ellipsoidChanged(const QString &ellipsoid)
Emitted when the project ellipsoid is changed.
void projectColorsChanged()
Emitted whenever the project's color scheme has been changed.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
void labelingEngineSettingsChanged()
Emitted when global configuration of the labeling engine changes.
void customVariablesChanged()
Emitted whenever the expression variables stored in the project have been changed.
void readProject(const QDomDocument &)
Emitted when a project is being read.
T mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layerId converted to type T.
QgsMapThemeCollection * mapThemeCollection()
Returns pointer to the project's map theme collection.
void missingDatumTransforms(const QStringList &missingTransforms)
Emitted when datum transforms stored in the project are not available locally.
void readProjectWithContext(const QDomDocument &, QgsReadWriteContext &context)
Emitted when a project is being read.
void layerWillBeRemoved(QgsMapLayer *layer)
Emitted when a layer is about to be removed from the registry.
void transactionGroupsChanged()
Emitted whenever a new transaction group has been created or a transaction group has been removed.
void loadingLayerMessageReceived(const QString &layerName, const QList< QgsReadWriteContext::ReadWriteMessage > &messages)
Emitted when loading layers has produced some messages.
QVector< T > mapLayersByShortName(const QString &shortName) const
Retrieves a list of matching registered layers by layer shortName with a specified layer type,...
void writeProject(QDomDocument &)
Emitted when the project is being written.
Qgis::ProjectCapabilities capabilities() const
Returns the project's capabilities, which dictate optional functionality which can be selectively ena...
void projectSaved()
Emitted when the project file has been written and closed.
void layersWillBeRemoved(const QList< QgsMapLayer * > &layers)
Emitted when one or more layers are about to be removed from the registry.
void layerLoaded(int i, int n)
Emitted when a layer from a projects was read.
void selectionColorChanged()
Emitted whenever the project's selection color has been changed.
void removeAll()
Emitted when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals ar...
void backgroundColorChanged()
Emitted whenever the project's canvas background color has been changed.
void transformContextChanged()
Emitted when the project transformContext() is changed.
void legendLayersAdded(const QList< QgsMapLayer * > &layers)
Emitted, when a layer was added to the registry and the legend.
void layerRemoved(const QString &layerId)
Emitted after a layer was removed from the registry.
void homePathChanged()
Emitted when the home path of the project changes.
void dirtySet()
Emitted when setDirty(true) is called.
void layersAdded(const QList< QgsMapLayer * > &layers)
Emitted when one or more layers were added to the registry.
void isDirtyChanged(bool dirty)
Emitted when the project dirty status changes.
void topologicalEditingChanged()
Emitted when the topological editing flag has changed.
void avoidIntersectionsModeChanged()
Emitted whenever the avoid intersections mode has changed.
void loadingLayer(const QString &layerName)
Emitted when a layer is loaded.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
A registry / canonical manager of data providers.
The class is used as a container of context for various read/write operations on other objects.
This class manages a set of relations between layers.
Expression function for use within a QgsExpressionContextScope.
The QgsServer class provides OGC web services.
This class is a composition of two QSettings instances:
This is a container for configuration of the snapping of the project.
An interface for classes which can visit style entity (e.g.
This is the class is providing tolerance value in map unit values.
Used for the collecting of strings from projects for translation and creation of ts files.
The edit buffer group manages a group of edit buffers.
Represents a vector layer which manages a vector based data sets.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
CORE_EXPORT bool zip(const QString &zip, const QStringList &files)
Zip the list of files in the zip file.
CORE_EXPORT bool unzip(const QString &zip, const QString &dir, QStringList &files, bool checkConsistency=true)
Unzip a zip file in an output directory.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
CORE_EXPORT QgsProjectVersion getVersion(QDomDocument const &doc)
Returns the version string found in the given DOM document.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
const QgsCoordinateReferenceSystem & crs