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;
1119 void setAvoidIntersectionsLayers( const QList<
QgsVectorLayer *> &layers );
1126 void setAvoidIntersectionsMode( const
Qgis::AvoidIntersectionsMode mode );
1133 Qgis::AvoidIntersectionsMode avoidIntersectionsMode()
const {
return mAvoidIntersectionsMode; }
1140 QVariantMap customVariables()
const;
1146 void setCustomVariables(
const QVariantMap &customVariables );
1176 int validCount()
const;
1185 Q_INVOKABLE
QgsMapLayer *mapLayer(
const QString &layerId )
const;
1207 return qobject_cast<T>( mapLayer( layerId ) );
1218 Q_INVOKABLE QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
1229 QList<QgsMapLayer *> mapLayersByShortName(
const QString &shortName )
const;
1240 QMap<QString, QgsMapLayer *> mapLayers(
const bool validOnly =
false )
const;
1245 bool isZipped()
const;
1259 template <
typename T>
1262 return mLayerStore->layers<T>();
1276 template <
typename T>
1280 const auto constMapLayers { mLayerStore->layers<T>() };
1281 for (
const auto l : constMapLayers )
1283 if ( ! l->serverProperties()->shortName().isEmpty() )
1285 if ( l->serverProperties()->shortName() == shortName )
1288 else if ( l->name() == shortName )
1322 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
1323 bool addToLegend =
true,
1354 bool addToLegend =
true,
1370 void removeMapLayers(
const QStringList &layerIds );
1387 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
1402 void removeMapLayer(
const QString &layerId );
1450 void removeAllMapLayers();
1457 void reloadAllLayers();
1476 Q_DECL_DEPRECATED
void setTrustLayerMetadata(
bool trust )
SIP_DEPRECATED;
1488 Q_DECL_DEPRECATED
bool trustLayerMetadata() const
SIP_DEPRECATED;
1510 QString createAttachedFile( const QString &nameTemplate );
1518 QStringList attachedFiles() const;
1527 bool removeAttachedFile( const QString &path );
1537 QString attachmentIdentifier( const QString &attachedFile ) const;
1545 QString resolveAttachmentIdentifier( const QString &identifier ) const;
1571 Q_DECL_DEPRECATED QSet<
QgsMapLayer *> requiredLayers() const;
1581 Q_DECL_DEPRECATED
void setRequiredLayers( const QSet<
QgsMapLayer *> &layers );
1597 void setBackgroundColor( const QColor &color );
1605 QColor backgroundColor() const;
1613 void setSelectionColor( const QColor &color );
1621 QColor selectionColor() const;
1634 Q_DECL_DEPRECATED
void setMapScales( const QVector<
double> &scales )
SIP_DEPRECATED;
1647 Q_DECL_DEPRECATED QVector<
double> mapScales() const
SIP_DEPRECATED;
1657 Q_DECL_DEPRECATED
void setUseProjectScales(
bool enabled )
SIP_DEPRECATED;
1673 void generateTsFile( const QString &locale );
1675 QString translate( const QString &context, const QString &sourceText, const
char *disambiguation =
nullptr,
int n = -1 ) const override;
1710 bool loadFunctionsFromProject(
bool force = false )
SIP_SKIP;
1719 void cleanFunctionsFromProject()
SIP_SKIP;
1723 SIP_PYOBJECT __repr__();
1725 QString
str = QStringLiteral(
"<QgsProject: '%1'%2>" ).arg( sipCpp->fileName(),
1727 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
2145 void elevationShadingRendererChanged();
2163 void setDirty(
bool b = true );
2173 void setPresetHomePath( const QString &path );
2257 bool commitChanges( QStringList &commitErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2275 bool rollBack( QStringList &rollbackErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2278 void onMapLayersAdded( const QList<
QgsMapLayer *> &layers );
2279 void onMapLayersRemoved( const QList<
QgsMapLayer *> &layers );
2280 void cleanTransactionGroups(
bool force = false );
2281 void updateTransactionGroups();
2296 bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2302 void setError( const QString &errorMessage )
SIP_SKIP;
2319 bool addLayer( const QDomElement &layerElem,
2320 QList<QDomNode> &brokenNodes,
2322 Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags(),
2328 void removeAuxiliaryLayer( const
QgsMapLayer *ml );
2344 bool readProjectFile( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2347 bool writeProjectFile( const QString &filename );
2350 bool unzip( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2353 bool zip( const QString &filename );
2356 bool saveAuxiliaryStorage( const QString &filename = QString() );
2359 void loadProjectFlags( const QDomDocument *doc );
2365 void preloadProviders( const QVector<QDomNode> &asynchronusLayerNodes,
2369 int totalProviderCount );
2375 void releaseHandlesToProjectArchive();
2377 bool rebuildCrs3D( QString *error =
nullptr );
2379 Qgis::ProjectCapabilities mCapabilities;
2383 QString mErrorMessage;
2392 QHash< QString, QPair< QString,
bool> > mEmbeddedLayers;
2395 Qgis::AvoidIntersectionsMode mAvoidIntersectionsMode =
Qgis::AvoidIntersectionsMode::AllowIntersections;
2434 QVariantMap mCustomVariables;
2442 QString mOriginalPath;
2445 QString mSaveUserFull;
2446 QDateTime mSaveDateTime;
2454 mutable QString mCachedHomePath;
2456 QColor mBackgroundColor;
2457 QColor mSelectionColor;
2459 Qgis::DistanceUnit mDistanceUnits =
Qgis::DistanceUnit::Meters;
2460 Qgis::AreaUnit mAreaUnits =
Qgis::AreaUnit::SquareMeters;
2463 Qgis::TransactionMode mTransactionMode =
Qgis::TransactionMode::Disabled;
2465 Qgis::ProjectFlags mFlags;
2470 bool mDirty = false;
2471 int mDirtyBlockCount = 0;
2479 std::unique_ptr< QTranslator > mTranslator;
2481 bool mIsBeingDeleted = false;
2487 bool mBlockChangeSignalsDuringClear = false;
2488 int mBlockSnappingUpdates = 0;
2502 friend class TestQgsProject;