Created
February 2, 2023 02:21
-
-
Save rouault/ed533d30738bda806ebeaa47f0877e2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/python/core/auto_generated/vector/qgsvectordataprovider.sip.in b/python/core/auto_generated/vector/qgsvectordataprovider.sip.in | |
index ee09c8888f..f37cb83eb9 100644 | |
--- a/python/core/auto_generated/vector/qgsvectordataprovider.sip.in | |
+++ b/python/core/auto_generated/vector/qgsvectordataprovider.sip.in | |
@@ -712,6 +712,7 @@ Gets this providers encoding | |
QFlags<QgsVectorDataProvider::Capability> operator|(QgsVectorDataProvider::Capability f1, QFlags<QgsVectorDataProvider::Capability> f2); | |
+ | |
/************************************************************************ | |
* This file has been generated automatically from * | |
* * | |
diff --git a/python/core/auto_generated/vector/qgsvectorlayer.sip.in b/python/core/auto_generated/vector/qgsvectorlayer.sip.in | |
index 32ff58ac44..b99e6fa580 100644 | |
--- a/python/core/auto_generated/vector/qgsvectorlayer.sip.in | |
+++ b/python/core/auto_generated/vector/qgsvectorlayer.sip.in | |
@@ -511,7 +511,11 @@ Uses :py:class:`QgsExpression` | |
:return: The expression which will be used to preview features for this layer | |
%End | |
- virtual QgsVectorDataProvider *dataProvider() ${SIP_FINAL}; | |
+ virtual QgsVectorDataProvider *dataProvider() ${SIP_FINAL} | |
+ | |
+; | |
+ | |
+ | |
virtual QgsMapLayerTemporalProperties *temporalProperties(); | |
diff --git a/src/core/gps/qgsvectorlayergpslogger.cpp b/src/core/gps/qgsvectorlayergpslogger.cpp | |
index a232774f8c..8cba845e69 100644 | |
--- a/src/core/gps/qgsvectorlayergpslogger.cpp | |
+++ b/src/core/gps/qgsvectorlayergpslogger.cpp | |
@@ -184,7 +184,12 @@ void QgsVectorLayerGpsLogger::endCurrentTrack() | |
if ( mUseEditBuffer ) | |
mTracksLayer->addFeature( feature, QgsFeatureSink::Flag::FastInsert ); | |
else | |
- mTracksLayer->dataProvider()->addFeature( feature, QgsFeatureSink::Flag::FastInsert ); | |
+ { | |
+ if ( auto lProvider = mTracksLayer->dataProviderNullablePtr().get() ) | |
+ { | |
+ lProvider->addFeature( feature, QgsFeatureSink::Flag::FastInsert ); | |
+ } | |
+ } | |
} | |
resetTrack(); | |
} | |
diff --git a/src/core/vector/qgsvectordataprovider.h b/src/core/vector/qgsvectordataprovider.h | |
index f11781d1a6..84f275752b 100644 | |
--- a/src/core/vector/qgsvectordataprovider.h | |
+++ b/src/core/vector/qgsvectordataprovider.h | |
@@ -715,4 +715,26 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat | |
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorDataProvider::Capabilities ) | |
+#ifndef SIP_RUN | |
+ | |
+class QgsVectorDataProviderPtr | |
+{ | |
+ QgsVectorDataProvider *m_ptr; | |
+ public: | |
+ explicit QgsVectorDataProviderPtr( QgsVectorDataProvider *inPtr ): m_ptr( inPtr ) {} | |
+ | |
+ inline QgsVectorDataProvider *get() { return m_ptr; } | |
+}; | |
+ | |
+class QgsVectorDataProviderConstPtr | |
+{ | |
+ const QgsVectorDataProvider *m_ptr; | |
+ public: | |
+ explicit QgsVectorDataProviderConstPtr( const QgsVectorDataProvider *inPtr ): m_ptr( inPtr ) {} | |
+ | |
+ inline const QgsVectorDataProvider *get() const { return m_ptr; } | |
+}; | |
+ | |
+#endif | |
+ | |
#endif | |
diff --git a/src/core/vector/qgsvectorlayer.h b/src/core/vector/qgsvectorlayer.h | |
index 5733a3557a..7aa257d673 100644 | |
--- a/src/core/vector/qgsvectorlayer.h | |
+++ b/src/core/vector/qgsvectorlayer.h | |
@@ -661,8 +661,24 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte | |
*/ | |
QString displayExpression() const; | |
- QgsVectorDataProvider *dataProvider() FINAL; | |
- const QgsVectorDataProvider *dataProvider() const FINAL SIP_SKIP; | |
+ QgsVectorDataProvider *dataProvider() FINAL | |
+#ifndef SIP_RUN | |
+ __attribute__( ( deprecated( "Use dataProviderNullablePtr()" ) ) ) | |
+#endif | |
+ ; | |
+ | |
+#ifndef SIP_RUN | |
+ const QgsVectorDataProvider *dataProvider() const FINAL | |
+ __attribute__( ( deprecated( "Use dataProviderNullablePtr()" ) ) ) | |
+ ; | |
+#endif | |
+ | |
+#pragma GCC diagnostic push | |
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |
+ QgsVectorDataProviderPtr dataProviderNullablePtr() { return QgsVectorDataProviderPtr( dataProvider() ); } SIP_SKIP; | |
+ QgsVectorDataProviderConstPtr dataProviderNullablePtr() const { return QgsVectorDataProviderConstPtr( dataProvider() ); } SIP_SKIP; | |
+#pragma GCC diagnostic pop | |
+ | |
QgsMapLayerTemporalProperties *temporalProperties() override; | |
QgsMapLayerElevationProperties *elevationProperties() override; | |
QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment