QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
QgsAbstractValidityCheck::prepareCheck
virtual bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)
Prepares the check for execution, and returns true if the check can be run.
Definition: qgsabstractvaliditycheck.h:137
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsAbstractValidityCheck::Type
Type
Check types.
Definition: qgsabstractvaliditycheck.h:98
QgsValidityCheckResult::Type
Type
Result types.
Definition: qgsabstractvaliditycheck.h:42
QgsValidityCheckContext
Base class for validity check contexts.
Definition: qgsvaliditycheckcontext.h:35
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
qgis_sip.h
QgsValidityCheckResult::checkId
QString checkId
ID of the check which generated the result.
Definition: qgsabstractvaliditycheck.h:65
QgsAbstractValidityCheck
Abstract base class for individual validity checks.
Definition: qgsabstractvaliditycheck.h:92
QgsValidityCheckResult
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass.
Definition: qgsabstractvaliditycheck.h:37
QgsValidityCheckResult::Critical
@ Critical
Critical error - notify user of result and prevent operation from proceeding.
Definition: qgsabstractvaliditycheck.h:45
QgsValidityCheckResult::title
QString title
A short, translated string summarising the result.
Definition: qgsabstractvaliditycheck.h:54
QgsValidityCheckResult::detailedDescription
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
Definition: qgsabstractvaliditycheck.h:60
QgsValidityCheckResult::Warning
@ Warning
Warning only, allow operation to proceed but notify user of result.
Definition: qgsabstractvaliditycheck.h:44
QgsValidityCheckResult::type
Type type
Result type.
Definition: qgsabstractvaliditycheck.h:49