25 qDeleteAll( mChecks );
30 QList<const QgsAbstractValidityCheck *> results;
34 results.append( check );
41 QList< const QgsAbstractValidityCheck * > results;
44 if ( check && check->checkType() == type )
52 mChecks.append( check );
57 int index = mChecks.indexOf( check );
59 delete mChecks.takeAt( index );
64 QList<QgsValidityCheckResult> result;
65 const std::vector<std::unique_ptr<QgsAbstractValidityCheck> > toCheck = createChecks( type );
67 for (
const std::unique_ptr< QgsAbstractValidityCheck > &check : toCheck )
72 if ( !check->prepareCheck( context, feedback ) )
76 feedback->
setProgress( static_cast< double >( i ) / toCheck.size() * 100 );
81 const QList< QgsValidityCheckResult > checkResults = check->runCheck( context, feedback );
84 checkResult.checkId = check->id();
85 result << checkResult;
90 feedback->
setProgress( static_cast< double >( i ) / toCheck.size() * 100 );
96 std::vector<std::unique_ptr<QgsAbstractValidityCheck> > QgsValidityCheckRegistry::createChecks(
int type )
const 98 const QList< const QgsAbstractValidityCheck *> toCheck =
checks( type );
99 std::vector<std::unique_ptr<QgsAbstractValidityCheck> > results;
100 results.reserve( toCheck.size() );
103 results.emplace_back( std::unique_ptr< QgsAbstractValidityCheck >( check->create() ) );
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass...
void setProgress(double progress)
Sets the current progress for the feedback object.
QList< const QgsAbstractValidityCheck * > checks() const
Returns the list of available checks.
QList< QgsValidityCheckResult > runChecks(int type, const QgsValidityCheckContext *context, QgsFeedback *feedback) const
Runs all checks of the specified type and returns a list of results.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
QgsValidityCheckRegistry()
~QgsValidityCheckRegistry()
bool isCanceled() const
Tells whether the operation has been canceled already.
void removeCheck(QgsAbstractValidityCheck *check)
Removes a check from the registry.
Abstract base class for individual validity checks.
Base class for validity check contexts.
void addCheck(QgsAbstractValidityCheck *check)
Adds a check to the registry.