QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
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 "qgstaskmanager.h"
22#include <QReadWriteLock>
23#include <memory>
24
25class QgsFeedback;
27
46class CORE_EXPORT QgsProviderSublayerTask : public QgsTask
47{
48 Q_OBJECT
49
50 public:
51
56 QgsProviderSublayerTask( const QString &uri, bool includeSystemTables = false );
57
64 QgsProviderSublayerTask( const QString &uri, const QString &providerKey, bool includeSystemTables = false );
65
67
71 QList<QgsProviderSublayerDetails> results() const;
72
73 void cancel() override;
74
75 protected:
76
77 bool run() override;
78
79 private:
80
81 QString mUri;
82
83 QString mProviderKey;
84
85 bool mIncludeSystemTables = false;
86
87 std::unique_ptr< QgsFeedback > mFeedback;
88
89 QList<QgsProviderSublayerDetails> mResults;
90
91 mutable QReadWriteLock mLock;
92
93};
94
95#endif // QGSPROVIDERSUBLAYERTASKTASK_H
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Contains details about a sub layer available from a dataset.
A QgsTask which retrieves sublayer details for a URI.
~QgsProviderSublayerTask() override
Abstract base class for long running background tasks.
virtual bool run()=0
Performs the task's operation.
virtual void cancel()
Notifies the task that it should terminate.