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 )
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 )
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() );
2062 void elevationShadingRendererChanged();
2082 void setDirty(
bool b = true );
2092 void setPresetHomePath( const QString &path );
2176 bool commitChanges( QStringList &commitErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2194 bool rollBack( QStringList &rollbackErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2197 void onMapLayersAdded( const QList<
QgsMapLayer *> &layers );
2198 void onMapLayersRemoved( const QList<
QgsMapLayer *> &layers );
2199 void cleanTransactionGroups(
bool force = false );
2200 void updateTransactionGroups();
2215 bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2221 void setError( const QString &errorMessage )
SIP_SKIP;
2238 bool addLayer( const QDomElement &layerElem,
2239 QList<QDomNode> &brokenNodes,
2241 Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags(),
2247 void removeAuxiliaryLayer( const
QgsMapLayer *ml );
2263 bool readProjectFile( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2266 bool writeProjectFile( const QString &filename );
2269 bool unzip( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2272 bool zip( const QString &filename );
2275 bool saveAuxiliaryStorage( const QString &filename = QString() );
2278 void loadProjectFlags( const QDomDocument *doc );
2284 void preloadProviders( const QVector<QDomNode> &asynchronusLayerNodes,
2288 int totalProviderCount );
2294 void releaseHandlesToProjectArchive();
2296 Qgis::ProjectCapabilities mCapabilities;
2300 QString mErrorMessage;
2309 QHash< QString, QPair< QString,
bool> > mEmbeddedLayers;
2312 Qgis::AvoidIntersectionsMode mAvoidIntersectionsMode =
Qgis::AvoidIntersectionsMode::AllowIntersections;
2351 QVariantMap mCustomVariables;
2359 QString mOriginalPath;
2362 QString mSaveUserFull;
2363 QDateTime mSaveDateTime;
2371 mutable QString mCachedHomePath;
2373 QColor mBackgroundColor;
2374 QColor mSelectionColor;
2376 Qgis::DistanceUnit mDistanceUnits =
Qgis::DistanceUnit::Meters;
2377 Qgis::AreaUnit mAreaUnits =
Qgis::AreaUnit::SquareMeters;
2380 Qgis::TransactionMode mTransactionMode =
Qgis::TransactionMode::Disabled;
2382 Qgis::ProjectFlags mFlags;
2384 bool mDirty = false;
2385 int mDirtyBlockCount = 0;
2393 std::unique_ptr< QTranslator > mTranslator;
2395 bool mIsBeingDeleted = false;
2401 int mBlockSnappingUpdates = 0;
2415 friend class TestQgsProject;