File: qgsabstractvaliditycheck.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (156 lines) | stat: -rw-r--r-- 5,288 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/validity/qgsabstractvaliditycheck.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/



class QgsValidityCheckResult
{
%Docstring(signature="appended")
Represents an individual result from a validity check run by a
:py:class:`QgsAbstractValidityCheck` subclass.

Results can either be warnings or critical errors, as dictated by the
type member. Critical error are errors which are serious enough to
prevent an operation from proceeding, while a warning result will be
communicated to users, but not prevent them from proceeding.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsabstractvaliditycheck.h"
%End
  public:

    enum Type /BaseType=IntEnum/
    {
      Warning,
      Critical,
    };

    Type type;

    QString title;

    QString detailedDescription;

    QString checkId;

};

class QgsAbstractValidityCheck
{
%Docstring(signature="appended")
Abstract base class for individual validity checks.

Validity checks represent objects which can run a test using a
:py:class:`QgsValidityCheckContext`, and return the results of the check
via :py:class:`QgsValidityCheckResult` objects.

Checks can be used for many different use cases, e.g. validating a
layout's contents before allowing an export to occur, or validating the
contents of a Processing model (and warning if required plugin based
providers are not available or if compulsory algorithm parameters have
not been populated).

Subclasses must indicate the type of check they represent via the
:py:func:`~checkType` method. When checks are performed, all the
registered checks with a matching check type are performed sequentially.
The check type also dictates the subclass of the
:py:class:`QgsValidityCheckContext` which is given to the subclass'
runCheck method.

Checks must be registered in the application's
:py:class:`QgsValidityCheckRegistry`, which is accessible via
:py:func:`QgsApplication.validityCheckRegistry()`.

.. seealso:: :py:class:`QgsValidityCheckRegistry`

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsabstractvaliditycheck.h"
%End
  public:

    enum class Type /BaseType=IntEnum/
      {
      LayoutCheck,
      UserCheck,
    };

    virtual ~QgsAbstractValidityCheck();

    virtual QgsAbstractValidityCheck *create() const = 0 /Factory/;
%Docstring
Creates a new instance of the check and returns it.
%End

    virtual QString id() const = 0;
%Docstring
Returns the unique ID of the check.

This is a non-translated, non-user visible string identifying the check.
%End

    virtual int checkType() const = 0;
%Docstring
Returns the type of the check.
%End

    virtual bool prepareCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback );
%Docstring
Prepares the check for execution, and returns ``True`` if the check can
be run.

This method is always called from the main thread, and subclasses can
implement it to do preparatory steps which are not thread safe (e.g.
obtaining feature sources from vector layers). It is followed by a call
to :py:func:`~QgsAbstractValidityCheck.runCheck`, which may be performed
in a background thread.

Individual calls to
:py:func:`~QgsAbstractValidityCheck.prepareCheck`/:py:func:`~QgsAbstractValidityCheck.runCheck`
are run on a new instance of the check (see
:py:func:`~QgsAbstractValidityCheck.create`), so subclasses can safely
store state from the :py:func:`~QgsAbstractValidityCheck.prepareCheck`
method ready for the subsequent
:py:func:`~QgsAbstractValidityCheck.runCheck` method.

The ``context`` argument gives the wider in which the check is being
run.
%End

    virtual QList< QgsValidityCheckResult > runCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback ) = 0;
%Docstring
Runs the check and returns a list of results. If the check is "passed"
and no warnings or errors are generated, then an empty list should be
returned.

This method may be called in a background thread, so subclasses should
take care to ensure that only thread-safe methods are used. It is always
preceded by a call to :py:func:`~QgsAbstractValidityCheck.prepareCheck`.

If a check needs to perform non-thread-safe tests, these should be
implemented within :py:func:`~QgsAbstractValidityCheck.prepareCheck` and
stored in the subclass instance to be returned by this method.

The ``context`` argument gives the wider in which the check is being
run.
%End

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/validity/qgsabstractvaliditycheck.h                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/