Skip to content

Commit f5a3e60

Browse files
committed
Update documentation
1 parent ad63009 commit f5a3e60

File tree

7 files changed

+91
-4
lines changed

7 files changed

+91
-4
lines changed

python/core/qgsvectordataprovider.sip.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ Providers with the FastTruncate capability will use an optimised method to trunc
233233
%End
234234

235235
virtual bool cancel();
236+
%Docstring
237+
Cancels the pending query.
238+
239+
:return: true if the pending query has been interrupted, false otherwise
240+
241+
.. versionadded:: 3.2
242+
%End
236243

237244
virtual bool addAttributes( const QList<QgsField> &attributes );
238245
%Docstring

python/core/qgsvirtuallayerdefinition.sip.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,23 @@ Set the name of the field with unique identifiers
151151
%End
152152

153153
void setPostpone( bool postpone );
154+
%Docstring
155+
Sets the postpone mode. If ``postpone`` is true, then the loading is
156+
delayed until an explicit reloading of the layer.
157+
158+
:param postpone: True to delay the loading, false otherwise
159+
160+
.. versionadded:: 3.2
161+
%End
162+
154163
bool postpone() const;
164+
%Docstring
165+
Returns the postpone mode.
166+
167+
:return: True if the loading is delayed, false otherwise.
168+
169+
.. versionadded:: 3.2
170+
%End
155171

156172
QString geometryField() const;
157173
%Docstring

python/core/qgsvirtuallayertask.sip

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ class QgsVirtualLayerTask : QgsTask
1313
{
1414
%Docstring
1515

16-
Initializes a virtual layer in a separated task.
16+
Initializes a virtual layer with postpone mode activated and reloads the
17+
data in a separated thread.
1718

18-
.. versionadded:: 3.0
19+
.. versionadded:: 3.2
1920
%End
2021

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

2627
QgsVirtualLayerTask( const QgsVirtualLayerDefinition &definition );
28+
%Docstring
29+
Constructor.
30+
31+
:param definition: The definition to use for initializing the virtual layer
32+
%End
2733

2834
QgsVectorLayer *layer();
35+
%Docstring
36+
Returns the underlying virtual layer.
37+
%End
2938

3039
QgsVirtualLayerDefinition definition() const;
40+
%Docstring
41+
Returns the virtual layer definition.
42+
%End
3143

3244
virtual bool run();
3345

46+
%Docstring
47+
Reloads the data.
48+
49+
:return: True if the virtual layer is valid, false otherwise.
50+
%End
3451

3552
virtual void cancel();
3653

54+
%Docstring
55+
Cancels the pending query and the parent task.
56+
%End
3757

3858
};
3959

src/core/qgsvectordataprovider.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat
249249
*/
250250
virtual bool truncate();
251251

252+
/**
253+
* Cancels the pending query.
254+
* \returns true if the pending query has been interrupted, false otherwise
255+
* \since QGIS 3.2
256+
*/
252257
virtual bool cancel();
253258

254259
/**

src/core/qgsvirtuallayerdefinition.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,19 @@ class CORE_EXPORT QgsVirtualLayerDefinition
131131
//! Set the name of the field with unique identifiers
132132
void setUid( const QString &uid ) { mUid = uid; }
133133

134+
/**
135+
* Sets the postpone mode. If \a postpone is true, then the loading is
136+
* delayed until an explicit reloading of the layer.
137+
* \param postpone True to delay the loading, false otherwise
138+
* \since QGIS 3.2
139+
*/
134140
void setPostpone( bool postpone ) { mPostpone = postpone; }
141+
142+
/**
143+
* Returns the postpone mode.
144+
* \returns True if the loading is delayed, false otherwise.
145+
* \since QGIS 3.2
146+
*/
135147
bool postpone() const { return mPostpone; }
136148

137149
//! Get the name of the geometry field. Empty if no geometry field

src/core/qgsvirtuallayertask.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,42 @@
2525
/**
2626
* \ingroup core
2727
*
28-
* Initializes a virtual layer in a separated task.
28+
* Initializes a virtual layer with postpone mode activated and reloads the
29+
* data in a separated thread.
2930
*
30-
* \since QGIS 3.0
31+
* \since QGIS 3.2
3132
*/
3233
class CORE_EXPORT QgsVirtualLayerTask : public QgsTask
3334
{
3435
Q_OBJECT
3536

3637
public:
3738

39+
/**
40+
* Constructor.
41+
* \param definition The definition to use for initializing the virtual layer
42+
*/
3843
QgsVirtualLayerTask( const QgsVirtualLayerDefinition &definition );
3944

45+
/**
46+
* Returns the underlying virtual layer.
47+
*/
4048
QgsVectorLayer *layer();
4149

50+
/**
51+
* Returns the virtual layer definition.
52+
*/
4253
QgsVirtualLayerDefinition definition() const;
4354

55+
/**
56+
* Reloads the data.
57+
* \returns True if the virtual layer is valid, false otherwise.
58+
*/
4459
bool run() override;
4560

61+
/**
62+
* Cancels the pending query and the parent task.
63+
*/
4664
void cancel() override;
4765

4866
private:

src/providers/virtual/qgsvirtuallayerprovider.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@ class QgsVirtualLayerProvider: public QgsVectorDataProvider
5353
QString description() const override;
5454
QgsAttributeList pkAttributeIndexes() const override;
5555
QSet<QgsMapLayerDependency> dependencies() const override;
56+
57+
/**
58+
* Interrupts the pending query.
59+
* \since QGIS 3.2
60+
*/
5661
bool cancel() override;
5762

63+
/**
64+
* Reloads the underlying data.
65+
* \since QGIS 3.2
66+
*/
5867
void reloadData() override;
5968

6069
private:

0 commit comments

Comments
 (0)