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 )
144 WMSOnlineResource = 2,
159 static void setInstance(
QgsProject *project ) ;
181 void setTitle(
const QString &title );
189 QString title()
const;
197 Qgis::ProjectCapabilities
capabilities()
const {
return mCapabilities; }
207 Qgis::ProjectFlags
flags()
const {
return mFlags; }
217 void setFlags( Qgis::ProjectFlags flags );
236 QString saveUser()
const;
245 QString saveUserFullName()
const;
252 QDateTime lastSaveDateTime()
const;
264 bool isDirty()
const;
272 void setFileName(
const QString &name );
280 QString fileName()
const;
293 void setOriginalPath(
const QString &path );
306 QString originalPath()
const;
332 QDateTime lastModified() const;
339 QString absoluteFilePath() const;
346 QString absolutePath() const;
352 QString baseName() const;
360 Qgis::FilePathType filePathStorage() const;
368 void setFilePathStorage(
Qgis::FilePathType type );
392 QString ellipsoid() const;
399 void setEllipsoid( const QString &ellipsoid );
434 bool read( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
444 bool read(
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
455 bool readLayer( const QDomNode &layerNode );
464 bool write( const QString &filename );
484 bool writeEntry( const QString &scope, const QString &key,
bool value )
SIP_PYNAME( writeEntryBool );
497 bool writeEntry( const QString &scope, const QString &key,
double value )
SIP_PYNAME( writeEntryDouble );
509 bool writeEntry( const QString &scope, const QString &key,
int value );
521 bool writeEntry( const QString &scope, const QString &key, const QString &value );
533 bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
545 QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(),
bool *ok
SIP_OUT =
nullptr ) const;
557 QString readEntry( const QString &scope, const QString &key, const QString &def = QString(),
bool *ok
SIP_OUT =
nullptr ) const;
569 int readNumEntry( const QString &scope, const QString &key,
int def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
581 double readDoubleEntry( const QString &scope, const QString &key,
double def = 0,
bool *ok
SIP_OUT =
nullptr ) const;
593 bool readBoolEntry( const QString &scope, const QString &key,
bool def = false,
bool *ok
SIP_OUT =
nullptr ) const;
598 bool removeEntry( const QString &scope, const QString &key );
608 QStringList entryList( const QString &scope, const QString &key ) const;
618 QStringList subkeyList( const QString &scope, const QString &key ) const;
626 void dumpProperties() const;
639 QString writePath( const QString &filename ) const;
644 QString readPath( const QString &filename ) const;
647 QString error() const;
660 QString layerIsEmbedded( const QString &
id ) const;
670 bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
671 bool saveFlag = true,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() )
SIP_SKIP;
679 QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
682 void setTopologicalEditing(
bool enabled );
685 bool topologicalEditing() const;
692 Qgis::DistanceUnit distanceUnits()
const {
return mDistanceUnits; }
726 QString homePath()
const;
740 QString presetHomePath()
const;
928 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QList<
QgsMapLayer *> &layers );
934 Q_DECL_DEPRECATED
void setNonIdentifiableLayers( const QStringList &layerIds );
940 Q_DECL_DEPRECATED QStringList nonIdentifiableLayers() const;
960 Q_DECL_DEPRECATED
void setAutoTransaction(
bool autoTransaction )
SIP_DEPRECATED;
968 Qgis::TransactionMode transactionMode() const;
979 bool setTransactionMode(
Qgis::TransactionMode transactionMode );
997 QgsTransactionGroup *transactionGroup( const QString &providerKey, const QString &connString );
1011 Q_DECL_DEPRECATED
bool evaluateDefaultValues() const
SIP_DEPRECATED;
1018 Q_DECL_DEPRECATED
void setEvaluateDefaultValues(
bool evaluateDefaultValues )
SIP_DEPRECATED;
1040 void setAvoidIntersectionsLayers( const QList<
QgsVectorLayer *> &layers );
1047 void setAvoidIntersectionsMode( const
Qgis::AvoidIntersectionsMode mode );
1054 Qgis::AvoidIntersectionsMode avoidIntersectionsMode()
const {
return mAvoidIntersectionsMode; }
1061 QVariantMap customVariables()
const;
1067 void setCustomVariables(
const QVariantMap &customVariables );
1097 int validCount()
const;
1106 Q_INVOKABLE
QgsMapLayer *mapLayer(
const QString &layerId )
const;
1128 return qobject_cast<T>( mapLayer( layerId ) );
1139 QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
1150 QList<QgsMapLayer *> mapLayersByShortName(
const QString &shortName )
const;
1161 QMap<QString, QgsMapLayer *> mapLayers(
const bool validOnly =
false )
const;
1166 bool isZipped()
const;
1180 template <
typename T>
1183 return mLayerStore->layers<T>();
1197 template <
typename T>
1201 const auto constMapLayers { mLayerStore->layers<T>() };
1202 for (
const auto l : constMapLayers )
1204 if ( ! l->shortName().isEmpty() )
1206 if ( l->shortName() == shortName )
1209 else if ( l->name() == shortName )
1243 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
1244 bool addToLegend =
true,
1275 bool addToLegend =
true,
1291 void removeMapLayers(
const QStringList &layerIds );
1308 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
1323 void removeMapLayer(
const QString &layerId );
1371 void removeAllMapLayers();
1378 void reloadAllLayers();
1397 Q_DECL_DEPRECATED
void setTrustLayerMetadata(
bool trust )
SIP_DEPRECATED;
1409 Q_DECL_DEPRECATED
bool trustLayerMetadata() const
SIP_DEPRECATED;
1431 QString createAttachedFile( const QString &nameTemplate );
1439 QStringList attachedFiles() const;
1448 bool removeAttachedFile( const QString &path );
1458 QString attachmentIdentifier( const QString &attachedFile ) const;
1466 QString resolveAttachmentIdentifier( const QString &identifier ) const;
1492 Q_DECL_DEPRECATED QSet<
QgsMapLayer *> requiredLayers() const;
1502 Q_DECL_DEPRECATED
void setRequiredLayers( const QSet<
QgsMapLayer *> &layers );
1518 void setBackgroundColor( const QColor &color );
1526 QColor backgroundColor() const;
1534 void setSelectionColor( const QColor &color );
1542 QColor selectionColor() const;
1555 Q_DECL_DEPRECATED
void setMapScales( const QVector<
double> &scales )
SIP_DEPRECATED;
1568 Q_DECL_DEPRECATED QVector<
double> mapScales() const
SIP_DEPRECATED;
1578 Q_DECL_DEPRECATED
void setUseProjectScales(
bool enabled )
SIP_DEPRECATED;
1594 void generateTsFile( const QString &locale );
1606 QString translate( const QString &context, const QString &sourceText, const
char *disambiguation =
nullptr,
int n = -1 ) const override;
1634 SIP_PYOBJECT __repr__();
1636 QString
str = QStringLiteral(
"<QgsProject: '%1'%2>" ).arg( sipCpp->fileName(),
1638 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
2017 void elevationShadingRendererChanged();
2035 void setDirty(
bool b = true );
2045 void setPresetHomePath( const QString &path );
2129 bool commitChanges( QStringList &commitErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2147 bool rollBack( QStringList &rollbackErrors
SIP_OUT,
bool stopEditing = true,
QgsVectorLayer *vectorLayer =
nullptr );
2150 void onMapLayersAdded( const QList<
QgsMapLayer *> &layers );
2151 void onMapLayersRemoved( const QList<
QgsMapLayer *> &layers );
2152 void cleanTransactionGroups(
bool force = false );
2153 void updateTransactionGroups();
2168 bool _getMapLayers( const QDomDocument &doc, QList<QDomNode> &brokenNodes,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2174 void setError( const QString &errorMessage )
SIP_SKIP;
2191 bool addLayer( const QDomElement &layerElem,
2192 QList<QDomNode> &brokenNodes,
2194 Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags(),
2200 void removeAuxiliaryLayer( const
QgsMapLayer *ml );
2216 bool readProjectFile( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2219 bool writeProjectFile( const QString &filename );
2222 bool unzip( const QString &filename,
Qgis::ProjectReadFlags flags =
Qgis::ProjectReadFlags() );
2225 bool zip( const QString &filename );
2228 bool saveAuxiliaryStorage( const QString &filename = QString() );
2231 void loadProjectFlags( const QDomDocument *doc );
2237 void preloadProviders( const QVector<QDomNode> &asynchronusLayerNodes,
2241 int totalProviderCount );
2247 void releaseHandlesToProjectArchive();
2249 Qgis::ProjectCapabilities mCapabilities;
2253 QString mErrorMessage;
2262 QHash< QString, QPair< QString,
bool> > mEmbeddedLayers;
2265 Qgis::AvoidIntersectionsMode mAvoidIntersectionsMode =
Qgis::AvoidIntersectionsMode::AllowIntersections;
2304 QVariantMap mCustomVariables;
2312 QString mOriginalPath;
2315 QString mSaveUserFull;
2316 QDateTime mSaveDateTime;
2324 mutable QString mCachedHomePath;
2326 QColor mBackgroundColor;
2327 QColor mSelectionColor;
2329 Qgis::DistanceUnit mDistanceUnits =
Qgis::DistanceUnit::Meters;
2330 Qgis::AreaUnit mAreaUnits =
Qgis::AreaUnit::SquareMeters;
2333 Qgis::TransactionMode mTransactionMode =
Qgis::TransactionMode::Disabled;
2335 Qgis::ProjectFlags mFlags;
2337 bool mDirty = false;
2338 int mDirtyBlockCount = 0;
2346 std::unique_ptr< QTranslator > mTranslator;
2348 bool mIsBeingDeleted = false;
2354 int mBlockSnappingUpdates = 0;
2368 friend class TestQgsProject;