Remove leftover QObject inheritance

This commit is contained in:
Nyall Dawson 2019-01-10 13:19:43 +10:00
parent 93bfbd00fc
commit b80829ce59
5 changed files with 12 additions and 19 deletions

View File

@ -41,8 +41,7 @@ result will be communicated to users, but not prevent them from proceeding.
}; };
class QgsAbstractValidityCheck
class QgsAbstractValidityCheck : QObject
{ {
%Docstring %Docstring
Abstract base class for individual validity checks. Abstract base class for individual validity checks.
@ -77,6 +76,8 @@ Checks must be registered in the application's :py:class:`QgsValidityCheckRegist
TypeUserCheck, TypeUserCheck,
}; };
virtual ~QgsAbstractValidityCheck();
virtual QgsAbstractValidityCheck *create() const = 0 /Factory/; virtual QgsAbstractValidityCheck *create() const = 0 /Factory/;
%Docstring %Docstring
Creates a new instance of the check and returns it. Creates a new instance of the check and returns it.
@ -126,9 +127,6 @@ The ``context`` argument gives the wider in which the check is being run.
}; };
/************************************************************************ /************************************************************************
* This file has been generated automatically from * * This file has been generated automatically from *
* * * *

View File

@ -51,9 +51,9 @@ bool QgsLayoutScaleBarValidityCheck::prepareCheck( const QgsValidityCheckContext
{ {
QgsValidityCheckResult res; QgsValidityCheckResult res;
res.type = QgsValidityCheckResult::Warning; 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(); 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 ); mResults.append( res );
} }
} }

View File

@ -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 * \class QgsAbstractValidityCheck
* \ingroup core * \ingroup core
@ -92,7 +89,7 @@ class CORE_EXPORT QgsValidityCheckResult
* *
* \since QGIS 3.6 * \since QGIS 3.6
*/ */
class CORE_EXPORT QgsAbstractValidityCheck : public QObject class CORE_EXPORT QgsAbstractValidityCheck
{ {
public: public:
@ -104,6 +101,8 @@ class CORE_EXPORT QgsAbstractValidityCheck : public QObject
TypeUserCheck = 10000, //!< Starting point for custom user types TypeUserCheck = 10000, //!< Starting point for custom user types
}; };
virtual ~QgsAbstractValidityCheck() = default;
/** /**
* Creates a new instance of the check and returns it. * Creates a new instance of the check and returns it.
*/ */
@ -158,7 +157,4 @@ class CORE_EXPORT QgsAbstractValidityCheck : public QObject
}; };
#endif // QGSABSTRACTVALIDITYCHECK_H #endif // QGSABSTRACTVALIDITYCHECK_H

View File

@ -28,10 +28,10 @@ QgsValidityCheckRegistry::~QgsValidityCheckRegistry()
QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks() const QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks() const
{ {
QList<const QgsAbstractValidityCheck *> results; QList<const QgsAbstractValidityCheck *> results;
for ( const QPointer< QgsAbstractValidityCheck > &check : mChecks ) for ( const QgsAbstractValidityCheck *check : mChecks )
{ {
if ( check ) if ( check )
results.append( check.data() ); results.append( check );
} }
return results; return results;
} }
@ -39,10 +39,10 @@ QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks() const
QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks( int type ) const QList<const QgsAbstractValidityCheck *> QgsValidityCheckRegistry::checks( int type ) const
{ {
QList< const QgsAbstractValidityCheck * > results; QList< const QgsAbstractValidityCheck * > results;
for ( const QPointer< QgsAbstractValidityCheck > &check : mChecks ) for ( const QgsAbstractValidityCheck *check : mChecks )
{ {
if ( check && check->checkType() == type ) if ( check && check->checkType() == type )
results << check.data(); results << check;
} }
return results; return results;
} }

View File

@ -19,7 +19,6 @@
#include "qgis_sip.h" #include "qgis_sip.h"
#include "qgsabstractvaliditycheck.h" #include "qgsabstractvaliditycheck.h"
#include <QList> #include <QList>
#include <QPointer>
#include <memory> #include <memory>
#include <vector> #include <vector>