Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 2, 2018
1 parent ad63009 commit f5a3e60
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 4 deletions.
7 changes: 7 additions & 0 deletions python/core/qgsvectordataprovider.sip.in
Expand Up @@ -233,6 +233,13 @@ Providers with the FastTruncate capability will use an optimised method to trunc
%End

virtual bool cancel();
%Docstring
Cancels the pending query.

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

.. versionadded:: 3.2
%End

virtual bool addAttributes( const QList<QgsField> &attributes );
%Docstring
Expand Down
16 changes: 16 additions & 0 deletions python/core/qgsvirtuallayerdefinition.sip.in
Expand Up @@ -151,7 +151,23 @@ Set the name of the field with unique identifiers
%End

void setPostpone( bool postpone );
%Docstring
Sets the postpone mode. If ``postpone`` is true, then the loading is
delayed until an explicit reloading of the layer.

:param postpone: True to delay the loading, false otherwise

.. versionadded:: 3.2
%End

bool postpone() const;
%Docstring
Returns the postpone mode.

:return: True if the loading is delayed, false otherwise.

.. versionadded:: 3.2
%End

QString geometryField() const;
%Docstring
Expand Down
24 changes: 22 additions & 2 deletions python/core/qgsvirtuallayertask.sip
Expand Up @@ -13,9 +13,10 @@ class QgsVirtualLayerTask : QgsTask
{
%Docstring

Initializes a virtual layer in a separated task.
Initializes a virtual layer with postpone mode activated and reloads the
data in a separated thread.

.. versionadded:: 3.0
.. versionadded:: 3.2
%End

%TypeHeaderCode
Expand All @@ -24,16 +25,35 @@ Initializes a virtual layer in a separated task.
public:

QgsVirtualLayerTask( const QgsVirtualLayerDefinition &definition );
%Docstring
Constructor.

:param definition: The definition to use for initializing the virtual layer
%End

QgsVectorLayer *layer();
%Docstring
Returns the underlying virtual layer.
%End

QgsVirtualLayerDefinition definition() const;
%Docstring
Returns the virtual layer definition.
%End

virtual bool run();

%Docstring
Reloads the data.

:return: True if the virtual layer is valid, false otherwise.
%End

virtual void cancel();

%Docstring
Cancels the pending query and the parent task.
%End

};

Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsvectordataprovider.h
Expand Up @@ -249,6 +249,11 @@ 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
* \since QGIS 3.2
*/
virtual bool cancel();

/**
Expand Down
12 changes: 12 additions & 0 deletions src/core/qgsvirtuallayerdefinition.h
Expand Up @@ -131,7 +131,19 @@ class CORE_EXPORT QgsVirtualLayerDefinition
//! Set the name of the field with unique identifiers
void setUid( const QString &uid ) { mUid = uid; }

/**
* Sets the postpone mode. If \a postpone is true, then the loading is
* delayed until an explicit reloading of the layer.
* \param postpone True to delay the loading, false otherwise
* \since QGIS 3.2
*/
void setPostpone( bool postpone ) { mPostpone = postpone; }

/**
* Returns the postpone mode.
* \returns True if the loading is delayed, false otherwise.
* \since QGIS 3.2
*/
bool postpone() const { return mPostpone; }

//! Get the name of the geometry field. Empty if no geometry field
Expand Down
22 changes: 20 additions & 2 deletions src/core/qgsvirtuallayertask.h
Expand Up @@ -25,24 +25,42 @@
/**
* \ingroup core
*
* Initializes a virtual layer in a separated task.
* Initializes a virtual layer with postpone mode activated and reloads the
* data in a separated thread.
*
* \since QGIS 3.0
* \since QGIS 3.2
*/
class CORE_EXPORT QgsVirtualLayerTask : public QgsTask
{
Q_OBJECT

public:

/**
* Constructor.
* \param definition The definition to use for initializing the virtual layer
*/
QgsVirtualLayerTask( const QgsVirtualLayerDefinition &definition );

/**
* Returns the underlying virtual layer.
*/
QgsVectorLayer *layer();

/**
* Returns the virtual layer definition.
*/
QgsVirtualLayerDefinition definition() const;

/**
* Reloads the data.
* \returns True if the virtual layer is valid, false otherwise.
*/
bool run() override;

/**
* Cancels the pending query and the parent task.
*/
void cancel() override;

private:
Expand Down
9 changes: 9 additions & 0 deletions src/providers/virtual/qgsvirtuallayerprovider.h
Expand Up @@ -53,8 +53,17 @@ class QgsVirtualLayerProvider: public QgsVectorDataProvider
QString description() const override;
QgsAttributeList pkAttributeIndexes() const override;
QSet<QgsMapLayerDependency> dependencies() const override;

/**
* Interrupts the pending query.
* \since QGIS 3.2
*/
bool cancel() override;

/**
* Reloads the underlying data.
* \since QGIS 3.2
*/
void reloadData() override;

private:
Expand Down

0 comments on commit f5a3e60

Please sign in to comment.