@@ -180,7 +180,7 @@ Returns the display name of the layer.
180
180
181
181
virtual QgsDataProvider *dataProvider();
182
182
%Docstring
183
- Returns the layer's data provider.
183
+ Returns the layer's data provider, it may be null .
184
184
%End
185
185
186
186
@@ -966,6 +966,31 @@ Write just the symbology information for the layer into the document
966
966
.. versionadded:: 2.16
967
967
%End
968
968
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
+
969
994
QUndoStack *undoStack();
970
995
%Docstring
971
996
Returns pointer to layer's undo stack
@@ -1210,6 +1235,25 @@ Returns the message that should be notified by the provider to triggerRepaint
1210
1235
Returns true if the refresh on provider nofification is enabled
1211
1236
1212
1237
.. 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
1213
1257
%End
1214
1258
1215
1259
public slots:
@@ -1432,6 +1476,15 @@ Emitted when layer's flags have been modified.
1432
1476
.. seealso:: :py:func:`flags`
1433
1477
1434
1478
.. 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
1435
1488
%End
1436
1489
1437
1490
protected:
@@ -1535,6 +1588,11 @@ Read style data common to all layer types
1535
1588
.. versionadded:: 3.0
1536
1589
%End
1537
1590
1591
+ void setProviderType( const QString &providerType );
1592
+ %Docstring
1593
+ Sets the ``providerType`` (provider key)
1594
+ %End
1595
+
1538
1596
1539
1597
void appendError( const QgsErrorMessage &error );
1540
1598
%Docstring
@@ -1563,6 +1621,8 @@ Checks whether a new set of dependencies will introduce a cycle
1563
1621
%End
1564
1622
1565
1623
1624
+
1625
+
1566
1626
};
1567
1627
1568
1628
QFlags<QgsMapLayer::LayerFlag> operator|(QgsMapLayer::LayerFlag f1, QFlags<QgsMapLayer::LayerFlag> f2);
0 commit comments