QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsproxyprogresstask.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsproxyprogresstask.h
3 ----------------------
4 begin : August 2018
5 copyright : (C) 2018 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 QGSPROXYPROGRESSTASK_H
19#define QGSPROXYPROGRESSTASK_H
20
22#include "qgstaskmanager.h"
23
24#include <QWaitCondition>
25
37class CORE_EXPORT QgsProxyProgressTask : public QgsTask
38{
39 Q_OBJECT
40
41 public:
42
46 QgsProxyProgressTask( const QString &description, bool canCancel = false );
47
52
59 void finalize( bool result );
60
61 bool run() override;
62
68 void setProxyProgress( double progress );
69
70 void cancel() override;
71
72 signals:
73
79 void canceled();
80
81 private:
82
83 QWaitCondition mNotFinishedWaitCondition;
84 QMutex mNotFinishedMutex;
85 bool mAlreadyFinished = false;
86 bool mResult = true;
87
88};
89
100{
101 public:
102
106 QgsScopedProxyProgressTask( const QString &description );
107
112
114
118 void setProgress( double progress );
119
120 private:
121
122 QgsProxyProgressTask *mTask = nullptr;
123
124#ifdef SIP_RUN
127#endif
128
129 // SIP generates .cpp code that doesn't compile if commenting out the legit following line.
130 // Q_DISABLE_COPY( QgsScopedProxyProgressTask )
131};
132
133#endif // QGSPROXYPROGRESSTASK_H
A QgsTask shell which proxies progress reports.
QgsProxyProgressTask(const QgsProxyProgressTask &other)=delete
QgsProxyProgressTask cannot be copied.
void canceled()
Emitted when the task is canceled.
QgsProxyProgressTask & operator=(const QgsProxyProgressTask &other)=delete
QgsProxyProgressTask cannot be copied.
Scoped QgsScopedProxyProgressTask, which automatically adds the proxy task to the application task ma...
QgsScopedProxyProgressTask & operator=(const QgsScopedProxyProgressTask &other)=delete
QgsScopedProxyProgressTask cannot be copied.
QgsScopedProxyProgressTask(const QgsScopedProxyProgressTask &other)=delete
QgsScopedProxyProgressTask cannot be copied.
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.
void setProgress(double progress)
Sets the task's current progress.