Skip to content

Commit

Permalink
Remove leftover QObject inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 10, 2019
1 parent 93bfbd0 commit b80829c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
Expand Up @@ -41,8 +41,7 @@ result will be communicated to users, but not prevent them from proceeding.

};


class QgsAbstractValidityCheck : QObject
class QgsAbstractValidityCheck
{
%Docstring
Abstract base class for individual validity checks.
Expand Down Expand Up @@ -77,6 +76,8 @@ Checks must be registered in the application's :py:class:`QgsValidityCheckRegist
TypeUserCheck,
};

virtual ~QgsAbstractValidityCheck();

virtual QgsAbstractValidityCheck *create() const = 0 /Factory/;
%Docstring
Creates a new instance of the check and returns it.
Expand Down Expand Up @@ -126,9 +127,6 @@ The ``context`` argument gives the wider in which the check is being run.

};




/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
4 changes: 2 additions & 2 deletions src/app/layout/qgslayoutvaliditychecks.cpp
Expand Up @@ -51,9 +51,9 @@ bool QgsLayoutScaleBarValidityCheck::prepareCheck( const QgsValidityCheckContext
{
QgsValidityCheckResult res;
res.type = QgsValidityCheckResult::Warning;
res.title = tr( "Scalebar is not linked to a map" );
res.title = QObject::tr( "Scalebar is not linked to a map" );
const QString name = bar->displayName().toHtmlEscaped();
res.detailedDescription = tr( "The scalebar “%1” is not linked to a map item. This scale will be misleading." ).arg( name );
res.detailedDescription = QObject::tr( "The scalebar “%1” is not linked to a map item. This scale will be misleading." ).arg( name );
mResults.append( res );
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/core/validity/qgsabstractvaliditycheck.h
Expand Up @@ -66,9 +66,6 @@ class CORE_EXPORT QgsValidityCheckResult

};

// note -- this is a QObject so that we can store just weak pointers to it -- avoiding crashes
// if a Python plugin doesn't correctly remove checks on plugin unload

/**
* \class QgsAbstractValidityCheck
* \ingroup core
Expand All @@ -92,7 +89,7 @@ class CORE_EXPORT QgsValidityCheckResult
*
* \since QGIS 3.6
*/
class CORE_EXPORT QgsAbstractValidityCheck : public QObject
class CORE_EXPORT QgsAbstractValidityCheck
{

public:
Expand All @@ -104,6 +101,8 @@ class CORE_EXPORT QgsAbstractValidityCheck : public QObject
TypeUserCheck = 10000, //!< Starting point for custom user types
};

virtual ~QgsAbstractValidityCheck() = default;

/**
* Creates a new instance of the check and returns it.
*/
Expand Down Expand Up @@ -158,7 +157,4 @@ class CORE_EXPORT QgsAbstractValidityCheck : public QObject

};




#endif // QGSABSTRACTVALIDITYCHECK_H
8 changes: 4 additions & 4 deletions src/core/validity/qgsvaliditycheckregistry.cpp
Expand Up @@ -28,21 +28,21 @@ QgsValidityCheckRegistry::~QgsValidityCheckRegistry()
QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks() const
{
QList<const QgsAbstractValidityCheck *> results;
for ( const QPointer< QgsAbstractValidityCheck > &check : mChecks )
for ( const QgsAbstractValidityCheck *check : mChecks )
{
if ( check )
results.append( check.data() );
results.append( check );
}
return results;
}

QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks( int type ) const
{
QList< const QgsAbstractValidityCheck * > results;
for ( const QPointer< QgsAbstractValidityCheck > &check : mChecks )
for ( const QgsAbstractValidityCheck *check : mChecks )
{
if ( check && check->checkType() == type )
results << check.data();
results << check;
}
return results;
}
Expand Down
1 change: 0 additions & 1 deletion src/core/validity/qgsvaliditycheckregistry.h
Expand Up @@ -19,7 +19,6 @@
#include "qgis_sip.h"
#include "qgsabstractvaliditycheck.h"
#include <QList>
#include <QPointer>
#include <memory>
#include <vector>

Expand Down

0 comments on commit b80829c

Please sign in to comment.