Update documentation

This commit is contained in:
Blottiere Paul 2018-01-23 10:08:19 +00:00
parent ad630094c1
commit f5a3e60b4e
7 changed files with 91 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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
};

View File

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

View File

@ -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

View File

@ -25,9 +25,10 @@
/**
* \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
{
@ -35,14 +36,31 @@ class CORE_EXPORT QgsVirtualLayerTask : public QgsTask
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:

View File

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