QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgsprovidersublayertask.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprovidersublayertask.h
3 ----------------------
4 begin : June 2021
5 copyright : (C) 2021 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROVIDERSUBLAYERTASKTASK_H
19#define QGSPROVIDERSUBLAYERTASKTASK_H
20
21#include <memory>
22
23#include "qgstaskmanager.h"
24
25#include <QReadWriteLock>
26
27class QgsFeedback;
29
48class CORE_EXPORT QgsProviderSublayerTask : public QgsTask
49{
50 Q_OBJECT
51
52 public:
53
58 QgsProviderSublayerTask( const QString &uri, bool includeSystemTables = false );
59
66 QgsProviderSublayerTask( const QString &uri, const QString &providerKey, bool includeSystemTables = false );
67
69
73 QList<QgsProviderSublayerDetails> results() const;
74
75 void cancel() override;
76
77 protected:
78
79 bool run() override;
80
81 private:
82
83 QString mUri;
84
85 QString mProviderKey;
86
87 bool mIncludeSystemTables = false;
88
89 std::unique_ptr< QgsFeedback > mFeedback;
90
91 QList<QgsProviderSublayerDetails> mResults;
92
93 mutable QReadWriteLock mLock;
94
95};
96
97#endif // QGSPROVIDERSUBLAYERTASKTASK_H
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Contains details about a sub layer available from a dataset.
QList< QgsProviderSublayerDetails > results() const
Returns the sublayer details as calculated by the task.
QgsProviderSublayerTask(const QString &uri, bool includeSystemTables=false)
Constructor for QgsProviderSublayerTask, which retrieves sublayer details for the specified uri.
~QgsProviderSublayerTask() override
virtual bool run()=0
Performs the task's operation.
virtual void cancel()
Notifies the task that it should terminate.
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.