QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsabstractvaliditycheck.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsabstractvaliditycheck.h
3  --------------------------
4  begin : November 2018
5  copyright : (C) 2018 by Nyall Dawson
6  email : nyall dot dawson 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 #ifndef QGSABSTRACTVALIDITYCHECK_H
16 #define QGSABSTRACTVALIDITYCHECK_H
17 
18 #include "qgis_core.h"
19 #include "qgis_sip.h"
20 #include <QString>
21 #include <QObject>
22 
24 class QgsFeedback;
25 
37 class CORE_EXPORT QgsValidityCheckResult
38 {
39  public:
40 
42  enum Type
43  {
46  };
47 
50 
54  QString title;
55 
61 
65  QString checkId;
66 
67 };
68 
92 class CORE_EXPORT QgsAbstractValidityCheck
93 {
94 
95  public:
96 
98  enum Type
99  {
100  TypeLayoutCheck = 0,
101  TypeUserCheck = 10000,
102  };
103 
104  virtual ~QgsAbstractValidityCheck() = default;
105 
109  virtual QgsAbstractValidityCheck *create() const = 0 SIP_FACTORY;
110 
116  virtual QString id() const = 0;
117 
121  virtual int checkType() const = 0;
122 
137  virtual bool prepareCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback )
138  {
139  Q_UNUSED( context )
140  Q_UNUSED( feedback )
141  return true;
142  }
143 
156  virtual QList< QgsValidityCheckResult > runCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback ) = 0;
157 
158 };
159 
160 #endif // QGSABSTRACTVALIDITYCHECK_H
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass...
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
Warning only, allow operation to proceed but notify user of result.
QString checkId
ID of the check which generated the result.
virtual bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)
Prepares the check for execution, and returns true if the check can be run.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Definition: qgsfeedback.h:44
#define SIP_FACTORY
Definition: qgis_sip.h:69
Abstract base class for individual validity checks.
Critical error - notify user of result and prevent operation from proceeding.
Base class for validity check contexts.
QString title
A short, translated string summarising the result.