Skip to content

Commit

Permalink
Rename cancel() to cancelReload() and update doc accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 2, 2018
1 parent 1a5e03f commit e531052
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
8 changes: 5 additions & 3 deletions python/core/qgsvectordataprovider.sip.in
Expand Up @@ -232,13 +232,15 @@ Providers with the FastTruncate capability will use an optimised method to trunc
.. seealso:: :py:func:`deleteFeatures`
%End

virtual bool cancel();
virtual bool cancelReload();
%Docstring
Cancels the pending query.
Cancels the current reloading of data.

:return: true if the pending query has been interrupted, false otherwise
:return: true if the reloading has been correctly interrupted, false otherwise

.. versionadded:: 3.2

.. seealso:: :py:func:`reloadData`
%End

virtual bool addAttributes( const QList<QgsField> &attributes );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectordataprovider.cpp
Expand Up @@ -804,7 +804,7 @@ QTextCodec *QgsVectorDataProvider::textEncoding() const
return mEncoding;
}

bool QgsVectorDataProvider::cancel()
bool QgsVectorDataProvider::cancelReload()
{
return false;
}
Expand Down
7 changes: 4 additions & 3 deletions src/core/qgsvectordataprovider.h
Expand Up @@ -250,11 +250,12 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
virtual bool truncate();

/**
* Cancels the pending query.
* \returns true if the pending query has been interrupted, false otherwise
* Cancels the current reloading of data.
* \returns true if the reloading has been correctly interrupted, false otherwise
* \since QGIS 3.2
* \see reloadData()
*/
virtual bool cancel();
virtual bool cancelReload();

/**
* Adds new \a attributes to the provider. Returns true in case of success and false in case of failure.
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvirtuallayertask.cpp
Expand Up @@ -59,6 +59,6 @@ QgsVectorLayer *QgsVirtualLayerTask::takeLayer()

void QgsVirtualLayerTask::cancel()
{
mLayer->dataProvider()->cancel();
mLayer->dataProvider()->cancelReload();
QgsTask::cancel();
}
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayerprovider.cpp
Expand Up @@ -455,7 +455,7 @@ bool QgsVirtualLayerProvider::createIt()
return true;
}

bool QgsVirtualLayerProvider::cancel()
bool QgsVirtualLayerProvider::cancelReload()
{
return mSqlite.interrupt();
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayerprovider.h
Expand Up @@ -53,7 +53,7 @@ class QgsVirtualLayerProvider: public QgsVectorDataProvider
QString description() const override;
QgsAttributeList pkAttributeIndexes() const override;
QSet<QgsMapLayerDependency> dependencies() const override;
bool cancel() override;
bool cancelReload() override;
void reloadData() override;

private:
Expand Down

0 comments on commit e531052

Please sign in to comment.