Skip to content
Permalink
Browse files

Update documentation

  • Loading branch information
pblottiere committed Mar 2, 2018
1 parent ad63009 commit f5a3e60b4e3ae0bb5f34c7766421fca0d8a694d9
@@ -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
@@ -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
@@ -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
@@ -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

};

@@ -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();

/**
@@ -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
@@ -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:
@@ -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:

0 comments on commit f5a3e60

Please sign in to comment.
You can’t perform that action at this time.