QGIS API Documentation  3.9.0-Master (224899f119)
qgsproject.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsproject.h
3 
4  Implements persistent project state.
5 
6  -------------------
7  begin : July 23, 2004
8  copyright : (C) 2004 by Mark Coletti
9  email : mcoletti at gmail.com
10  ***************************************************************************/
11 
12 /***************************************************************************
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation; either version 2 of the License, or *
17  * (at your option) any later version. *
18  * *
19  ***************************************************************************/
20 
21 #ifndef QGSPROJECT_H
22 #define QGSPROJECT_H
23 
24 #include "qgis_core.h"
25 #include "qgis_sip.h"
26 #include <memory>
27 #include <QHash>
28 #include <QList>
29 #include <QObject>
30 #include <QPair>
31 #include <QFileInfo>
32 #include <QStringList>
33 #include <QTranslator>
34 
35 #include "qgsunittypes.h"
36 #include "qgssnappingconfig.h"
37 #include "qgsprojectversion.h"
41 #include "qgsprojectproperty.h"
42 #include "qgsmaplayerstore.h"
43 #include "qgsarchive.h"
44 #include "qgsreadwritecontext.h"
45 #include "qgsprojectmetadata.h"
46 #include "qgstranslationcontext.h"
47 #include "qgsprojecttranslator.h"
49 #include "qgscolorscheme.h"
50 
51 class QFileInfo;
52 class QDomDocument;
53 class QDomElement;
54 class QDomNode;
55 
56 class QgsLayerTreeGroup;
58 class QgsMapLayer;
60 class QgsPathResolver;
62 class QgsProjectStorage;
63 class QgsRelationManager;
64 class QgsTolerance;
66 class QgsVectorLayer;
68 class QgsLayoutManager;
69 class QgsLayerTree;
72 class QgsMapLayer;
73 class QgsBookmarkManager;
74 
90 class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenerator, public QgsProjectTranslator
91 {
92  Q_OBJECT
93  Q_PROPERTY( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
94  Q_PROPERTY( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
95  Q_PROPERTY( QString homePath READ homePath WRITE setPresetHomePath NOTIFY homePathChanged )
96  Q_PROPERTY( QgsCoordinateReferenceSystem crs READ crs WRITE setCrs NOTIFY crsChanged )
97  Q_PROPERTY( QgsCoordinateTransformContext transformContext READ transformContext WRITE setTransformContext NOTIFY transformContextChanged )
98  Q_PROPERTY( QString ellipsoid READ ellipsoid WRITE setEllipsoid NOTIFY ellipsoidChanged )
99  Q_PROPERTY( QgsMapThemeCollection *mapThemeCollection READ mapThemeCollection NOTIFY mapThemeCollectionChanged )
100  Q_PROPERTY( QgsSnappingConfig snappingConfig READ snappingConfig WRITE setSnappingConfig NOTIFY snappingConfigChanged )
101  Q_PROPERTY( QgsRelationManager *relationManager READ relationManager )
102  Q_PROPERTY( QList<QgsVectorLayer *> avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged )
103  Q_PROPERTY( QgsProjectMetadata metadata READ metadata WRITE setMetadata NOTIFY metadataChanged )
104 
105  public:
107  static QgsProject *instance();
108 
114  explicit QgsProject( QObject *parent SIP_TRANSFERTHIS = nullptr );
115 
116  ~QgsProject() override;
117 
127  void setTitle( const QString &title );
128 
135  QString title() const;
136 
140  bool isDirty() const;
141 
148  void setFileName( const QString &name );
149 
156  QString fileName() const;
157 
169  Q_DECL_DEPRECATED QFileInfo fileInfo() const SIP_DEPRECATED;
170 
177  QgsProjectStorage *projectStorage() const;
178 
183  QDateTime lastModified() const;
184 
190  QString absoluteFilePath() const;
191 
197  QString absolutePath() const;
198 
203  QString baseName() const;
204 
212 
222  void setCrs( const QgsCoordinateReferenceSystem &crs, bool adjustEllipsoid = false );
223 
230  QString ellipsoid() const;
231 
238  void setEllipsoid( const QString &ellipsoid );
239 
240 
250  QgsCoordinateTransformContext transformContext() const;
251 
261  void setTransformContext( const QgsCoordinateTransformContext &context );
262 
268  void clear();
269 
274  enum ReadFlag
275  {
276  FlagDontResolveLayers = 1 << 0,
277  };
278  Q_DECLARE_FLAGS( ReadFlags, ReadFlag )
279 
280 
286  bool read( const QString &filename, QgsProject::ReadFlags flags = nullptr );
287 
296  bool read( QgsProject::ReadFlags flags = nullptr );
297 
307  bool readLayer( const QDomNode &layerNode );
308 
317  bool write( const QString &filename );
318 
324  bool write();
325 
335  bool writeEntry( const QString &scope, const QString &key, bool value ) SIP_PYNAME( writeEntryBool );
336 
346  bool writeEntry( const QString &scope, const QString &key, double value ) SIP_PYNAME( writeEntryDouble );
347 
356  bool writeEntry( const QString &scope, const QString &key, int value );
357 
366  bool writeEntry( const QString &scope, const QString &key, const QString &value );
367 
376  bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
377 
384  QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(), bool *ok = nullptr ) const;
385 
386  QString readEntry( const QString &scope, const QString &key, const QString &def = QString(), bool *ok = nullptr ) const;
387  int readNumEntry( const QString &scope, const QString &key, int def = 0, bool *ok = nullptr ) const;
388  double readDoubleEntry( const QString &scope, const QString &key, double def = 0, bool *ok = nullptr ) const;
389  bool readBoolEntry( const QString &scope, const QString &key, bool def = false, bool *ok = nullptr ) const;
390 
391 
393  bool removeEntry( const QString &scope, const QString &key );
394 
395 
401  QStringList entryList( const QString &scope, const QString &key ) const;
402 
408  QStringList subkeyList( const QString &scope, const QString &key ) const;
409 
410 
414  // TODO Now slightly broken since re-factoring. Won't print out top-level key
415  // and redundantly prints sub-keys.
416  void dumpProperties() const;
417 
423  QgsPathResolver pathResolver() const;
424 
430  QString writePath( const QString &filename ) const;
431 
433  QString readPath( const QString &filename ) const;
434 
436  QString error() const;
437 
442  void setBadLayerHandler( QgsProjectBadLayerHandler *handler SIP_TRANSFER );
443 
445  QString layerIsEmbedded( const QString &id ) const;
446 
455  bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
456  bool saveFlag = true, QgsProject::ReadFlags flags = nullptr ) SIP_SKIP;
457 
465  QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers, QgsProject::ReadFlags flags = nullptr );
466 
468  void setTopologicalEditing( bool enabled );
469 
471  bool topologicalEditing() const;
472 
479  QgsUnitTypes::DistanceUnit distanceUnits() const;
480 
487  void setDistanceUnits( QgsUnitTypes::DistanceUnit unit );
488 
494  QgsUnitTypes::AreaUnit areaUnits() const;
495 
502  void setAreaUnits( QgsUnitTypes::AreaUnit unit );
503 
516  QString homePath() const;
517 
530  QString presetHomePath() const;
531 
532  QgsRelationManager *relationManager() const;
533 
540  const QgsLayoutManager *layoutManager() const SIP_SKIP;
541 
547  QgsLayoutManager *layoutManager();
548 
555  const QgsBookmarkManager *bookmarkManager() const SIP_SKIP;
556 
562  QgsBookmarkManager *bookmarkManager();
563 
568  QgsLayerTree *layerTreeRoot() const;
569 
574  QgsLayerTreeRegistryBridge *layerTreeRegistryBridge() const { return mLayerTreeRegistryBridge; }
575 
581  QgsMapThemeCollection *mapThemeCollection();
582 
587  QgsAnnotationManager *annotationManager();
588 
593  const QgsAnnotationManager *annotationManager() const SIP_SKIP;
594 
599  Q_DECL_DEPRECATED void setNonIdentifiableLayers( const QList<QgsMapLayer *> &layers );
600 
605  Q_DECL_DEPRECATED void setNonIdentifiableLayers( const QStringList &layerIds );
606 
611  Q_DECL_DEPRECATED QStringList nonIdentifiableLayers() const;
612 
620  bool autoTransaction() const;
621 
631  void setAutoTransaction( bool autoTransaction );
632 
641  QMap< QPair< QString, QString>, QgsTransactionGroup *> transactionGroups() SIP_SKIP;
642 
650  QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
651 
657  bool evaluateDefaultValues() const;
658 
664  void setEvaluateDefaultValues( bool evaluateDefaultValues );
665 
667 
673  QgsSnappingConfig snappingConfig() const;
674 
680  QList<QgsVectorLayer *> avoidIntersectionsLayers() const;
681 
687  void setAvoidIntersectionsLayers( const QList<QgsVectorLayer *> &layers );
688 
694  QVariantMap customVariables() const;
695 
700  void setCustomVariables( const QVariantMap &customVariables );
701 
706  void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
707 
712  const QgsLabelingEngineSettings &labelingEngineSettings() const;
713 
714  //
715  // Functionality from QgsMapLayerRegistry
716  //
717 
722  QgsMapLayerStore *layerStore();
723 
728  SIP_SKIP const QgsMapLayerStore *layerStore() const;
729 
731  int count() const;
732 
734  int validCount() const;
735 
743  Q_INVOKABLE QgsMapLayer *mapLayer( const QString &layerId ) const;
744 
745 #ifndef SIP_RUN
746 
762  template <class T>
763  T mapLayer( const QString &layerId ) const
764  {
765  return qobject_cast<T>( mapLayer( layerId ) );
766  }
767 #endif
768 
776  QList<QgsMapLayer *> mapLayersByName( const QString &layerName ) const;
777 
787  QList<QgsMapLayer *> mapLayersByShortName( const QString &shortName ) const;
788 
789 
798  QMap<QString, QgsMapLayer *> mapLayers( const bool validOnly = false ) const;
799 
803  bool isZipped() const;
804 
805 #ifndef SIP_RUN
806 
818  template <typename T>
819  QVector<T> layers() const
820  {
821  return mLayerStore->layers<T>();
822  }
823 
835  template <typename T>
836  QVector<T> mapLayersByShortName( const QString &shortName ) const
837  {
838  QVector<T> layers;
839  const auto constMapLayers { mLayerStore->layers<T>() };
840  for ( const auto l : constMapLayers )
841  {
842  if ( ! l->shortName().isEmpty() )
843  {
844  if ( l->shortName() == shortName )
845  layers << l;
846  }
847  else if ( l->name() == shortName )
848  {
849  layers << l;
850  }
851  }
852  return layers;
853  }
854 
855 #endif
856 
882  QList<QgsMapLayer *> addMapLayers( const QList<QgsMapLayer *> &mapLayers SIP_TRANSFER,
883  bool addToLegend = true,
884  bool takeOwnership SIP_PYARGREMOVE = true );
885 
913  QgsMapLayer *addMapLayer( QgsMapLayer *mapLayer SIP_TRANSFER,
914  bool addToLegend = true,
915  bool takeOwnership SIP_PYARGREMOVE = true );
916 
931  void removeMapLayers( const QStringList &layerIds );
932 
933  //TODO QGIS 4.0 - add PyName alias to avoid list type conversion error
934 
948  void removeMapLayers( const QList<QgsMapLayer *> &layers );
949 
963  void removeMapLayer( const QString &layerId );
964 
978  void removeMapLayer( QgsMapLayer *layer );
979 
987  QgsMapLayer *takeMapLayer( QgsMapLayer *layer ) SIP_TRANSFERBACK;
988 
999  void removeAllMapLayers();
1000 
1006  void reloadAllLayers();
1007 
1012  QgsCoordinateReferenceSystem defaultCrsForNewLayers() const;
1013 
1025  void setTrustLayerMetadata( bool trust );
1026 
1037  bool trustLayerMetadata() const { return mTrustLayerMetadata; }
1038 
1044  const QgsAuxiliaryStorage *auxiliaryStorage() const SIP_SKIP;
1045 
1051  QgsAuxiliaryStorage *auxiliaryStorage();
1052 
1061  QString attachedFile( const QString &fileName ) const SIP_SKIP;
1062 
1072  QgsStringMap attachedFiles() const SIP_SKIP;
1073 
1080  const QgsProjectMetadata &metadata() const;
1081 
1088  void setMetadata( const QgsProjectMetadata &metadata );
1089 
1098  Q_DECL_DEPRECATED QSet<QgsMapLayer *> requiredLayers() const;
1099 
1108  Q_DECL_DEPRECATED void setRequiredLayers( const QSet<QgsMapLayer *> &layers );
1109 
1116  void setProjectColors( const QgsNamedColorList &colors );
1117 
1122  void generateTsFile( const QString &locale );
1123 
1134  QString translate( const QString &context, const QString &sourceText, const char *disambiguation = nullptr, int n = -1 ) const override;
1135 
1145  bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
1146 
1147 #ifdef SIP_RUN
1148  SIP_PYOBJECT __repr__();
1149  % MethodCode
1150  QString str = QStringLiteral( "<QgsProject: '%1'%2>" ).arg( sipCpp->fileName(),
1151  sipCpp == QgsProject::instance() ? QStringLiteral( " (singleton instance)" ) : QString() );
1152  sipRes = PyUnicode_FromString( str.toUtf8().constData() );
1153  % End
1154 #endif
1155 
1156  signals:
1157 
1165  void cleared();
1166 
1170  void readProject( const QDomDocument & );
1171 
1175  void readProjectWithContext( const QDomDocument &, QgsReadWriteContext &context );
1176 
1180  void writeProject( QDomDocument & );
1181 
1190  void readMapLayer( QgsMapLayer *mapLayer, const QDomElement &layerNode );
1191 
1200  void writeMapLayer( QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
1201 
1205  void projectSaved();
1206 
1210  void oldProjectVersionWarning( const QString & );
1211 
1217  void layerLoaded( int i, int n );
1218 
1220  void loadingLayer( const QString &layerName );
1221 
1228  void loadingLayerMessageReceived( const QString &layerName, const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
1229 
1234  Q_DECL_DEPRECATED void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
1235 
1237  void fileNameChanged();
1238 
1245  void homePathChanged();
1246 
1250  void snappingConfigChanged( const QgsSnappingConfig &config );
1251 
1256  void customVariablesChanged();
1257 
1263  void crsChanged();
1264 
1272  void ellipsoidChanged( const QString &ellipsoid );
1273 
1274 
1281  void transformContextChanged();
1282 
1287  void missingDatumTransforms( const QStringList &missingTransforms );
1288 
1295  void transactionGroupsChanged();
1296 
1302  void topologicalEditingChanged();
1303 
1309  void avoidIntersectionsLayersChanged();
1310 
1322  void mapThemeCollectionChanged();
1323 
1328  void labelingEngineSettingsChanged();
1329 
1336  void metadataChanged();
1337 
1344  void projectColorsChanged();
1345 
1346  //
1347  // signals from QgsMapLayerRegistry
1348  //
1349 
1357  void layersWillBeRemoved( const QStringList &layerIds );
1358 
1366  void layersWillBeRemoved( const QList<QgsMapLayer *> &layers );
1367 
1377  void layerWillBeRemoved( const QString &layerId );
1378 
1388  void layerWillBeRemoved( QgsMapLayer *layer );
1389 
1396  void layersRemoved( const QStringList &layerIds );
1397 
1406  void layerRemoved( const QString &layerId );
1407 
1408  //TODO QGIS 4.0 - rename to past tense
1409 
1416  void removeAll();
1417 
1428  void layersAdded( const QList<QgsMapLayer *> &layers );
1429 
1436  void layerWasAdded( QgsMapLayer *layer );
1437 
1446  void legendLayersAdded( const QList<QgsMapLayer *> &layers );
1447 
1455  void isDirtyChanged( bool dirty );
1456 
1470  void collectAttachedFiles( QgsStringMap &files SIP_INOUT ) SIP_SKIP;
1471 
1472  public slots:
1473 
1479  void setSnappingConfig( const QgsSnappingConfig &snappingConfig );
1480 
1481  // TODO QGIS 4.0 - rename b to dirty
1482 
1490  void setDirty( bool b = true );
1491 
1500  void setPresetHomePath( const QString &path );
1501 
1511  void registerTranslatableContainers( QgsTranslationContext *translationContext, QgsAttributeEditorContainer *parent, const QString &layerId );
1512 
1519  void registerTranslatableObjects( QgsTranslationContext *translationContext );
1520 
1521  private slots:
1522  void onMapLayersAdded( const QList<QgsMapLayer *> &layers );
1523  void onMapLayersRemoved( const QList<QgsMapLayer *> &layers );
1524  void cleanTransactionGroups( bool force = false );
1525 
1526  private:
1527 
1528  static QgsProject *sProject;
1529 
1538  static void setInstance( QgsProject *project ) SIP_SKIP;
1539 
1548  bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes, QgsProject::ReadFlags flags = nullptr );
1549 
1554  void setError( const QString &errorMessage ) SIP_SKIP;
1555 
1560  void clearError() SIP_SKIP;
1561 
1569  bool addLayer( const QDomElement &layerElem, QList<QDomNode> &brokenNodes, QgsReadWriteContext &context, QgsProject::ReadFlags flags = nullptr ) SIP_SKIP;
1570 
1576  void initializeEmbeddedSubtree( const QString &projectFilePath, QgsLayerTreeGroup *group, QgsProject::ReadFlags flags = nullptr ) SIP_SKIP;
1577 
1582  void loadEmbeddedNodes( QgsLayerTreeGroup *group, QgsProject::ReadFlags flags = nullptr ) SIP_SKIP;
1583 
1585  bool readProjectFile( const QString &filename, QgsProject::ReadFlags flags = nullptr );
1586 
1588  bool writeProjectFile( const QString &filename );
1589 
1591  bool unzip( const QString &filename, QgsProject::ReadFlags flags = nullptr );
1592 
1594  bool zip( const QString &filename );
1595 
1597  bool saveAuxiliaryStorage( const QString &filename = QString() );
1598 
1599  std::unique_ptr< QgsMapLayerStore > mLayerStore;
1600 
1601  QString mErrorMessage;
1602 
1603  QgsProjectBadLayerHandler *mBadLayerHandler = nullptr;
1604 
1610  QHash< QString, QPair< QString, bool> > mEmbeddedLayers;
1611 
1612  QgsSnappingConfig mSnappingConfig;
1613 
1614  QgsRelationManager *mRelationManager = nullptr;
1615 
1616  std::unique_ptr<QgsAnnotationManager> mAnnotationManager;
1617  std::unique_ptr<QgsLayoutManager> mLayoutManager;
1618 
1619  QgsBookmarkManager *mBookmarkManager = nullptr;
1620 
1621  QgsLayerTree *mRootGroup = nullptr;
1622 
1623  QgsLayerTreeRegistryBridge *mLayerTreeRegistryBridge = nullptr;
1624 
1626  QMap< QPair< QString, QString>, QgsTransactionGroup *> mTransactionGroups;
1627 
1628  std::unique_ptr<QgsMapThemeCollection> mMapThemeCollection;
1629 
1630  std::unique_ptr<QgsLabelingEngineSettings> mLabelingEngineSettings;
1631 
1632  QVariantMap mCustomVariables;
1633 
1634  std::unique_ptr<QgsProjectArchive> mArchive;
1635 
1636  std::unique_ptr<QgsAuxiliaryStorage> mAuxiliaryStorage;
1637 
1638  QFile mFile; // current physical project file
1639 
1644  QString mHomePath;
1645  mutable QgsProjectPropertyKey mProperties; // property hierarchy, TODO: this shouldn't be mutable
1646  bool mAutoTransaction = false; // transaction grouped editing
1647  bool mEvaluateDefaultValues = false; // evaluate default values immediately
1649  bool mDirty = false; // project has been modified since it has been read or saved
1650  int mDirtyBlockCount = 0;
1651  bool mTrustLayerMetadata = false;
1652 
1653  QgsCoordinateTransformContext mTransformContext;
1654 
1655  QgsProjectMetadata mMetadata;
1656 
1657  std::unique_ptr< QTranslator > mTranslator;
1658 
1659  bool mIsBeingDeleted = false;
1660 
1662 
1663  // Required to avoid creating a new project in it's destructor
1664  friend class QgsProviderRegistry;
1665 
1666  // Required by QGIS Server for switching the current project instance
1667  friend class QgsConfigCache;
1668 };
1669 
1670 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProject::ReadFlags )
1671 
1672 
1693 class CORE_EXPORT QgsProjectDirtyBlocker
1694 {
1695  public:
1696 
1703  : mProject( project )
1704  {
1705  mProject->mDirtyBlockCount++;
1706  }
1707 
1709  QgsProjectDirtyBlocker( const QgsProjectDirtyBlocker &other ) = delete;
1710 
1712  QgsProjectDirtyBlocker &operator=( const QgsProjectDirtyBlocker &other ) = delete;
1713 
1715  {
1716  mProject->mDirtyBlockCount--;
1717  }
1718 
1719  private:
1720  QgsProject *mProject = nullptr;
1721 
1722 #ifdef SIP_RUN
1723  QgsProjectDirtyBlocker( const QgsProjectDirtyBlocker &other );
1724 #endif
1725 };
1726 
1732 CORE_EXPORT QgsProjectVersion getVersion( QDomDocument const &doc ) SIP_SKIP;
1733 
1734 #endif
Layer tree group node serves as a container for layers and further groups.
The class is used as a container of context for various read/write operations on other objects...
Base class for all map layer types.
Definition: qgsmaplayer.h:79
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
Manages storage of a set of QgsAnnotation annotation objects.
Helper functions for various unit types.
Definition: qgsunittypes.h:38
Class providing some utility methods to manage auxiliary storage.
Manages storage of a set of bookmarks.
#define SIP_INOUT
Definition: qgis_sip.h:71
const QgsCoordinateReferenceSystem & crs
An interface for classes which can visit style entity (e.g.
#define SIP_TRANSFERBACK
Definition: qgis_sip.h:48
QMap< QString, QString > QgsStringMap
Definition: qgis.h:597
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
T mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layerId converted to type T.
Definition: qgsproject.h:763
bool trustLayerMetadata() const
Returns true if the trust option is activated, false otherwise.
Definition: qgsproject.h:1037
ReadFlag
Flags which control project read behavior.
Definition: qgsproject.h:274
Namespace with helper functions for layer tree operations.
Definition: qgslayertree.h:32
CORE_EXPORT bool unzip(const QString &zip, const QString &dir, QStringList &files)
Unzip a zip file in an output directory.
Definition: qgsziputils.cpp:34
#define SIP_SKIP
Definition: qgis_sip.h:126
CORE_EXPORT QgsProjectVersion getVersion(QDomDocument const &doc)
Returns the version string found in the given DOM document.
Definition: qgsproject.cpp:868
A class to describe the version of a project.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This is the class is providing tolerance value in map unit values.
Definition: qgstolerance.h:32
Listens to the updates in map layer registry and does changes in layer tree.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
Reads and writes project states.
Definition: qgsproject.h:90
Contains information about the context in which a coordinate transform is executed.
const QgsProject * project(const QString &path)
If the project is not cached yet, then the project is read thanks to the path.
Wherever an object of this class is available, the derived translate function can be called from...
Manages storage of a set of layouts.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
Used for the collecting of strings from projects for translation and creation of ts files...
Abstract interface for generating an expression context.
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.
A registry / canonical manager of data providers.
Project property key node.
Cache for server configuration.
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:146
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
Definition: qgsproject.h:819
This class manages a set of relations between layers.
Stores global configuration for labeling engine.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:441
This class represents a coordinate reference system (CRS).
This is a container for attribute editors, used to group them visually in the attribute form if it is...
Abstract interface for project storage - to be implemented by various backends and registered in QgsP...
QgsProjectDirtyBlocker(QgsProject *project)
Constructor for QgsProjectDirtyBlocker.
Definition: qgsproject.h:1702
Temporarily blocks QgsProject "dirtying" for the lifetime of the object.
Definition: qgsproject.h:1693
A storage object for map layers, in which the layers are owned by the store and have their lifetime b...
Container class that allows storage of map themes consisting of visible map layers and layer styles...
This is a container for configuration of the snapping of the project.
Resolves relative paths into absolute paths and vice versa.
Represents a vector layer which manages a vector based data sets.
CORE_EXPORT bool zip(const QString &zip, const QStringList &files)
Zip the list of files in the zip file.
Interface for classes that handle missing layer files when reading project file.
QVector< T > mapLayersByShortName(const QString &shortName) const
Retrieves a list of matching registered layers by layer shortName with a specified layer type...
Definition: qgsproject.h:836
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
A structured metadata store for a map layer.