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 )
127 Q_PROPERTY(
Qgis::TransactionMode transactionMode READ transactionMode WRITE setTransactionMode NOTIFY transactionModeChanged )
145 WMSOnlineResource = 2,
160 static void setInstance(
QgsProject *project ) ;
182 void setTitle(
const QString &title );
190 QString title()
const;
237 QString saveUser()
const;
246 QString saveUserFullName()
const;
253 QDateTime lastSaveDateTime()
const;
265 bool isDirty()
const;
273 void setFileName(
const QString &name );
281 QString fileName()
const;
294 void setOriginalPath(
const QString &path );
307 QString originalPath()
const;
333 QDateTime lastModified() const;
340 QString absoluteFilePath() const;
347 QString absolutePath() const;
353 QString baseName() const;
361 Qgis::FilePathType filePathStorage() const;
369 void setFilePathStorage(
Qgis::FilePathType type );
428 QString ellipsoid() const;
437 void setEllipsoid( const QString &ellipsoid );
512 bool read( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
522 bool read(
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
533 bool readLayer( const QDomNode &layerNode );
542 bool write( const QString &filename );
562 bool writeEntry( const QString &scope, const QString &key,
bool value )
SIP_PYNAME( writeEntryBool );
575 bool writeEntry( const QString &scope, const QString &key,
double value )
SIP_PYNAME( writeEntryDouble );
587 bool writeEntry( const QString &scope, const QString &key,
int value );
599 bool writeEntry( const QString &scope, const QString &key, const QString &value );
611 bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
623 QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(),
bool *ok
SIP_OUT =
nullptr ) const;
635 QString readEntry( const QString &scope, const QString &key, const QString &def = QString(),
bool *ok
SIP_OUT =
nullptr ) const;
647 int readNumEntry( const QString &scope, const QString &key,
int def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
659 double readDoubleEntry( const QString &scope, const QString &key,
double def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
671 bool readBoolEntry( const QString &scope, const QString &key,
bool def = false,
bool *ok
SIP_OUT =
nullptr ) const;
676 bool removeEntry( const QString &scope, const QString &key );
686 QStringList entryList( const QString &scope, const QString &key ) const;
696 QStringList subkeyList( const QString &scope, const QString &key ) const;
704 void dumpProperties() const;
717 QString writePath( const QString &filename ) const;
722 QString readPath( const QString &filename ) const;
725 QString error() const;
738 QString layerIsEmbedded( const QString &
id ) const;
748 bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
749 bool saveFlag = true,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() )
SIP_SKIP;
757 QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
760 void setTopologicalEditing(
bool enabled );
763 bool topologicalEditing() const;
770 Qgis::DistanceUnit distanceUnits()
const {
return mDistanceUnits; }
804 QString homePath()
const;
818 QString presetHomePath()
const;
1006 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QList<
QgsMapLayer *> &layers );
1012 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QStringList &layerIds );
1018 Q_DECL_DEPRECATED QStringList nonIdentifiableLayers() const;
1038 Q_DECL_DEPRECATED
void setAutoTransaction(
bool autoTransaction )
SIP_DEPRECATED;
1046 Qgis::TransactionMode transactionMode() const;
1057 bool setTransactionMode(
Qgis::TransactionMode transactionMode );
1075 QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
1089 Q_DECL_DEPRECATED
bool evaluateDefaultValues() const
SIP_DEPRECATED;
1096 Q_DECL_DEPRECATED
void setEvaluateDefaultValues(
bool evaluateDefaultValues )
SIP_DEPRECATED;
1118 void setAvoidIntersectionsLayers( const QList<
QgsVectorLayer *> &layers );
1125 void setAvoidIntersectionsMode( const
Qgis::AvoidIntersectionsMode mode );
1132 Qgis::AvoidIntersectionsMode avoidIntersectionsMode()
const {
return mAvoidIntersectionsMode; }
1139 QVariantMap customVariables()
const;
1145 void setCustomVariables(
const QVariantMap &customVariables );
1175 int validCount()
const;
1184 Q_INVOKABLE
QgsMapLayer *mapLayer(
const QString &layerId )
const;
1206 return qobject_cast<T>( mapLayer( layerId ) );
1217 Q_INVOKABLE QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
1228 QList<QgsMapLayer *> mapLayersByShortName(
const QString &shortName )
const;
1239 QMap<QString, QgsMapLayer *> mapLayers(
const bool validOnly =
false )
const;
1244 bool isZipped()
const;
1258 template <
typename T>
1261 return mLayerStore->layers<T>();
1275 template <
typename T>
1279 const auto constMapLayers { mLayerStore->layers<T>() };
1280 for (
const auto l : constMapLayers )
1282 if ( ! l->serverProperties()->shortName().isEmpty() )
1284 if ( l->serverProperties()->shortName() == shortName )
1287 else if ( l->name() == shortName )
1321 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
1322 bool addToLegend =
true,
1353 bool addToLegend =
true,
1369 void removeMapLayers(
const QStringList &layerIds );
1386 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
1401 void removeMapLayer(
const QString &layerId );
1449 void removeAllMapLayers();
1456 void reloadAllLayers();
1475 Q_DECL_DEPRECATED
void setTrustLayerMetadata(
bool trust )
SIP_DEPRECATED;
1487 Q_DECL_DEPRECATED
bool trustLayerMetadata() const
SIP_DEPRECATED;
1509 QString createAttachedFile( const QString &nameTemplate );
1517 QStringList attachedFiles() const;
1526 bool removeAttachedFile( const QString &path );
1536 QString attachmentIdentifier( const QString &attachedFile ) const;
1544 QString resolveAttachmentIdentifier( const QString &identifier ) const;
1570 Q_DECL_DEPRECATED QSet<
QgsMapLayer *> requiredLayers() const;
1580 Q_DECL_DEPRECATED
void setRequiredLayers( const QSet<
QgsMapLayer *> &layers );
1596 void setBackgroundColor( const QColor &color );
1604 QColor backgroundColor() const;
1612 void setSelectionColor( const QColor &color );
1620 QColor selectionColor() const;
1633 Q_DECL_DEPRECATED
void setMapScales( const QVector<
double> &scales )
SIP_DEPRECATED;
1646 Q_DECL_DEPRECATED QVector<
double> mapScales() const
SIP_DEPRECATED;
1656 Q_DECL_DEPRECATED
void setUseProjectScales(
bool enabled )
SIP_DEPRECATED;
1672 void generateTsFile( const QString &locale );
1674 QString translate( const QString &context, const QString &sourceText, const
char *disambiguation =
nullptr,
int n = -1 ) const override;
1709 bool loadFunctionsFromProject(
bool force = false )
SIP_SKIP;
1718 void cleanFunctionsFromProject()
SIP_SKIP;
1722 SIP_PYOBJECT __repr__();
1724 QString
str = QStringLiteral(
"<QgsProject: '%1'%2>" ).arg( sipCpp->fileName(),
1726 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
2144 void elevationShadingRendererChanged();
2162 void setDirty(
bool b = true );
2172 void setPresetHomePath( const QString &path );
2256 bool commitChanges( QStringList &commitErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2274 bool rollBack( QStringList &rollbackErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2277 void onMapLayersAdded( const QList<
QgsMapLayer *> &layers );
2278 void onMapLayersRemoved( const QList<
QgsMapLayer *> &layers );
2279 void cleanTransactionGroups(
bool force = false );
2280 void updateTransactionGroups();
2295 bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2301 void setError( const QString &errorMessage )
SIP_SKIP;
2318 bool addLayer( const QDomElement &layerElem,
2319 QList<QDomNode> &brokenNodes,
2321 Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags(),
2327 void removeAuxiliaryLayer( const
QgsMapLayer *ml );
2343 bool readProjectFile( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2346 bool writeProjectFile( const QString &filename );
2349 bool unzip( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2352 bool zip( const QString &filename );
2355 bool saveAuxiliaryStorage( const QString &filename = QString() );
2358 void loadProjectFlags( const QDomDocument *doc );
2364 void preloadProviders( const QVector<QDomNode> &asynchronusLayerNodes,
2368 int totalProviderCount );
2374 void releaseHandlesToProjectArchive();
2376 bool rebuildCrs3D( QString *error =
nullptr );
2378 Qgis::ProjectCapabilities mCapabilities;
2382 QString mErrorMessage;
2391 QHash< QString, QPair< QString,
bool> > mEmbeddedLayers;
2394 Qgis::AvoidIntersectionsMode mAvoidIntersectionsMode =
Qgis::AvoidIntersectionsMode::AllowIntersections;
2433 QVariantMap mCustomVariables;
2441 QString mOriginalPath;
2444 QString mSaveUserFull;
2445 QDateTime mSaveDateTime;
2453 mutable QString mCachedHomePath;
2455 QColor mBackgroundColor;
2456 QColor mSelectionColor;
2458 Qgis::DistanceUnit mDistanceUnits =
Qgis::DistanceUnit::Meters;
2459 Qgis::AreaUnit mAreaUnits =
Qgis::AreaUnit::SquareMeters;
2462 Qgis::TransactionMode mTransactionMode =
Qgis::TransactionMode::Disabled;
2464 Qgis::ProjectFlags mFlags;
2469 bool mDirty = false;
2470 int mDirtyBlockCount = 0;
2478 std::unique_ptr< QTranslator > mTranslator;
2480 bool mIsBeingDeleted = false;
2486 bool mBlockChangeSignalsDuringClear = false;
2487 int mBlockSnappingUpdates = 0;
2501 friend class TestQgsProject;