QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsfeedback.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeedback.h
3  --------------------------------------
4  Date : July 2016
5  Copyright : (C) 2016 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSFEEDBACK_H
17 #define QGSFEEDBACK_H
18 
19 #include <QObject>
20 
40 class CORE_EXPORT QgsFeedback : public QObject
41 {
42  Q_OBJECT
43  public:
45  QgsFeedback( QObject* parent = nullptr )
46  : QObject( parent )
47  , mCancelled( false )
48  {}
49 
50  virtual ~QgsFeedback() {}
51 
53  void cancel()
54  {
55  if ( mCancelled )
56  return; // only emit the signal once
57  mCancelled = true;
58  emit cancelled();
59  }
60 
62  bool isCancelled() const { return mCancelled; }
63 
64  signals:
66  void cancelled();
67 
68  private:
70  bool mCancelled;
71 };
72 
73 #endif // QGSFEEDBACK_H
void cancel()
Tells the internal routines that the current operation should be cancelled. This should be run by the...
Definition: qgsfeedback.h:53
bool isCancelled() const
Tells whether the operation has been cancelled already.
Definition: qgsfeedback.h:62
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Definition: qgsfeedback.h:40
QgsFeedback(QObject *parent=nullptr)
Construct a feedback object.
Definition: qgsfeedback.h:45
virtual ~QgsFeedback()
Definition: qgsfeedback.h:50