QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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
24class QgsFeedback;
25
37class 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
92class 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
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
Abstract base class for individual validity checks.
virtual bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)
Prepares the check for execution, and returns true if the check can be run.
virtual QString id() const =0
Returns the unique ID of the check.
virtual int checkType() const =0
Returns the type of the check.
virtual QgsAbstractValidityCheck * create() const =0
Creates a new instance of the check and returns it.
virtual QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)=0
Runs the check and returns a list of results.
virtual ~QgsAbstractValidityCheck()=default
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:45
Base class for validity check contexts.
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass.
@ Critical
Critical error - notify user of result and prevent operation from proceeding.
@ Warning
Warning only, allow operation to proceed but notify user of result.
QString checkId
ID of the check which generated the result.
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
QString title
A short, translated string summarising the result.
#define SIP_FACTORY
Definition qgis_sip.h:76