Skip to content

Commit c8b2677

Browse files
authoredNov 6, 2018
Merge pull request #8359 from elpaso/handle-bad-layers2
[needs-docs][feature] Deferred handling of bad layers
2 parents c54c559 + 64bd7a7 commit c8b2677

File tree

57 files changed

+2740
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2740
-255
lines changed
 

‎python/core/auto_generated/layertree/qgslayertreeutils.sip.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ Returns true if any of the layers is modified
5656

5757
static void removeInvalidLayers( QgsLayerTreeGroup *group );
5858
%Docstring
59-
Remove layer nodes that refer to invalid layers
59+
Removes layer nodes that refer to invalid layers
60+
%End
61+
62+
static void storeOriginalLayersProperties( QgsLayerTreeGroup *group, const QDomDocument *doc );
63+
%Docstring
64+
Stores in a layer's originalXmlProperties the layer properties information
65+
66+
.. versionadded:: 3.6
6067
%End
6168

6269
static void replaceChildrenOfEmbeddedGroups( QgsLayerTreeGroup *group );

‎python/core/auto_generated/qgsmaplayer.sip.in

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Returns the display name of the layer.
180180

181181
virtual QgsDataProvider *dataProvider();
182182
%Docstring
183-
Returns the layer's data provider.
183+
Returns the layer's data provider, it may be null.
184184
%End
185185

186186

@@ -966,6 +966,31 @@ Write just the symbology information for the layer into the document
966966
.. versionadded:: 2.16
967967
%End
968968

969+
970+
virtual void setDataSource( const QString &dataSource, const QString &baseName, const QString &provider, const QgsDataProvider::ProviderOptions &options, bool loadDefaultStyleFlag = false );
971+
%Docstring
972+
Updates the data source of the layer. The layer's renderer and legend will be preserved only
973+
if the geometry type of the new data source matches the current geometry type of the layer.
974+
975+
Subclasses should override this method: default implementation does nothing.
976+
977+
:param dataSource: new layer data source
978+
:param baseName: base name of the layer
979+
:param provider: provider string
980+
:param options: provider options
981+
:param loadDefaultStyleFlag: set to true to reset the layer's style to the default for the
982+
data source
983+
984+
.. seealso:: :py:func:`dataSourceChanged`
985+
986+
.. versionadded:: 3.6
987+
%End
988+
989+
QString providerType() const;
990+
%Docstring
991+
Returns the provider type (provider key) for this layer
992+
%End
993+
969994
QUndoStack *undoStack();
970995
%Docstring
971996
Returns pointer to layer's undo stack
@@ -1210,6 +1235,25 @@ Returns the message that should be notified by the provider to triggerRepaint
12101235
Returns true if the refresh on provider nofification is enabled
12111236

12121237
.. versionadded:: 3.0
1238+
%End
1239+
1240+
QString originalXmlProperties() const;
1241+
%Docstring
1242+
Returns the XML properties of the original layer as they were when the layer
1243+
was first read from the project file. In case of new layers this is normally empty.
1244+
1245+
The storage format for the XML is qlr
1246+
1247+
.. versionadded:: 3.6
1248+
%End
1249+
1250+
void setOriginalXmlProperties( const QString &originalXmlProperties );
1251+
%Docstring
1252+
Sets the original XML properties for the layer to ``originalXmlProperties``
1253+
1254+
The storage format for the XML is qlr
1255+
1256+
.. versionadded:: 3.6
12131257
%End
12141258

12151259
public slots:
@@ -1432,6 +1476,15 @@ Emitted when layer's flags have been modified.
14321476
.. seealso:: :py:func:`flags`
14331477

14341478
.. versionadded:: 3.4
1479+
%End
1480+
1481+
void dataSourceChanged();
1482+
%Docstring
1483+
Emitted whenever the layer's data source has been changed.
1484+
1485+
.. seealso:: :py:func:`setDataSource`
1486+
1487+
.. versionadded:: 3.5
14351488
%End
14361489

14371490
protected:
@@ -1535,6 +1588,11 @@ Read style data common to all layer types
15351588
.. versionadded:: 3.0
15361589
%End
15371590

1591+
void setProviderType( const QString &providerType );
1592+
%Docstring
1593+
Sets the ``providerType`` (provider key)
1594+
%End
1595+
15381596

15391597
void appendError( const QgsErrorMessage &error );
15401598
%Docstring
@@ -1563,6 +1621,8 @@ Checks whether a new set of dependencies will introduce a cycle
15631621
%End
15641622

15651623

1624+
1625+
15661626
};
15671627

15681628
QFlags<QgsMapLayer::LayerFlag> operator|(QgsMapLayer::LayerFlag f1, QFlags<QgsMapLayer::LayerFlag> f2);

0 commit comments

Comments
 (0)
Please sign in to comment.