mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Adds a new interface QgsAbstractValidityCheck which defines a single "check" which can be performed on a given QgsValidityCheckContext. A new application-wide QgsValidityCheckRegistry registers and manages instances of all known checks, and allows running of all registered checks of a specific type at once. Initially the framework is focused toward print layout validity checks, but the interface has been designed to be generic enough to allow alternative types of validity checks (e.g. project save validity checks, processing model validity checks, etc.). The API is designed to be used both by internal validity checks and also to be extended by custom, organisation-specific validity checks. E.g., for print layout validity checks we could have:
78 lines
2.6 KiB
Plaintext
78 lines
2.6 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/validity/qgsvaliditycheckregistry.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
class QgsValidityCheckRegistry
|
|
{
|
|
%Docstring
|
|
This class keeps a list of QgsAbstractValidityCheck checks which can be used when
|
|
performing validity checks.
|
|
|
|
QgsValidityCheckRegistry is not usually directly created, but rather accessed through
|
|
:py:func:`QgsApplication.validityCheckRegistry()`
|
|
|
|
.. versionadded:: 3.6
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsvaliditycheckregistry.h"
|
|
%End
|
|
public:
|
|
|
|
QgsValidityCheckRegistry();
|
|
|
|
~QgsValidityCheckRegistry();
|
|
|
|
|
|
QList<QgsAbstractValidityCheck *> checks() const;
|
|
%Docstring
|
|
Returns the list of available checks.
|
|
%End
|
|
|
|
QList<QgsAbstractValidityCheck *> checks( int type ) const;
|
|
%Docstring
|
|
Returns the list of all available checks of the matching ``type``.
|
|
%End
|
|
|
|
void addCheck( QgsAbstractValidityCheck *check /Transfer/ );
|
|
%Docstring
|
|
Adds a ``check`` to the registry. Ownership of the check
|
|
is transferred to the registry.
|
|
%End
|
|
|
|
void removeCheck( QgsAbstractValidityCheck *check );
|
|
%Docstring
|
|
Removes a ``check`` from the registry.
|
|
The check object is automatically deleted.
|
|
%End
|
|
|
|
QList< QgsValidityCheckResult > runChecks( int type, const QgsValidityCheckContext *context, QgsFeedback *feedback ) const;
|
|
%Docstring
|
|
Runs all checks of the specified ``type`` and returns a list of results.
|
|
|
|
If all checks are "passed" and no warnings or errors are generated, then
|
|
an empty list will be returned.
|
|
|
|
The ``context`` argument gives the wider in which the check is being run.
|
|
|
|
The ``feedback`` argument is used to give progress reports and to support
|
|
cancelation of long-running checks.
|
|
%End
|
|
|
|
private:
|
|
QgsValidityCheckRegistry( const QgsValidityCheckRegistry &rh );
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/validity/qgsvaliditycheckregistry.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|