Skip to content

Commit

Permalink
Fix API issues causing malformed python stub files
Browse files Browse the repository at this point in the history
Fixes #46240
  • Loading branch information
nyalldawson committed Nov 29, 2021
1 parent 92b1255 commit 13e355c
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 12 deletions.
Expand Up @@ -31,7 +31,8 @@ expression context.

enum Flag
{
// UseSelectionIfPresent = 1 << 0,
// For future API flexibility only and to avoid sip issues, remove when real entries are added to flags.
Unused,
};
typedef QFlags<QgsProcessingContext::Flag> Flags;

Expand Down
Expand Up @@ -571,11 +571,11 @@ Returns the transaction this data provider is included in, if any.
Gets the list of layer ids on which this layer depends. This in particular determines the order of layer loading.
%End

virtual QList<QgsRelation> discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const;
virtual QList<QgsRelation> discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const;
%Docstring
Discover the available relations with the given layers.

:param self: the layer using this data provider.
:param target: the layer using this data provider.
:param layers: the other layers.

:return: the list of N-1 relations from this provider.
Expand Down
Expand Up @@ -36,6 +36,8 @@ Base class for graphic items representing model components in the model designer

enum Flag
{
// For future API flexibility only and to avoid sip issues, remove when real entries are added to flags.
Unused,
};
typedef QFlags<QgsModelComponentGraphicItem::Flag> Flags;

Expand Down
3 changes: 2 additions & 1 deletion src/core/processing/qgsprocessingcontext.h
Expand Up @@ -50,7 +50,8 @@ class CORE_EXPORT QgsProcessingContext
//! Flags that affect how processing algorithms are run
enum Flag
{
// UseSelectionIfPresent = 1 << 0,
// For future API flexibility only and to avoid sip issues, remove when real entries are added to flags.
Unused = 1 << 0, //!< Temporary unused entry
};
Q_DECLARE_FLAGS( Flags, Flag )

Expand Down
4 changes: 2 additions & 2 deletions src/core/vector/qgsvectordataprovider.h
Expand Up @@ -566,12 +566,12 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider, public QgsFeat

/**
* Discover the available relations with the given layers.
* \param self the layer using this data provider.
* \param target the layer using this data provider.
* \param layers the other layers.
* \returns the list of N-1 relations from this provider.
* \since QGIS 3.0
*/
virtual QList<QgsRelation> discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const;
virtual QList<QgsRelation> discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const;

/**
* Gets metadata, dependent on the provider type, that will be display in the metadata tab of the layer properties.
Expand Down
2 changes: 2 additions & 0 deletions src/gui/processing/models/qgsmodelcomponentgraphicitem.h
Expand Up @@ -60,6 +60,8 @@ class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject
//! Available flags
enum Flag
{
// For future API flexibility only and to avoid sip issues, remove when real entries are added to flags.
Unused = 1 << 0, //!< Temporary unused entry
};
Q_DECLARE_FLAGS( Flags, Flag )

Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -4976,7 +4976,7 @@ QList<QgsVectorLayer *> QgsPostgresProvider::searchLayers( const QList<QgsVector
return result;
}

QList<QgsRelation> QgsPostgresProvider::discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const
QList<QgsRelation> QgsPostgresProvider::discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const
{
QList<QgsRelation> result;

Expand Down Expand Up @@ -5067,7 +5067,7 @@ QList<QgsRelation> QgsPostgresProvider::discoverRelations( const QgsVectorLayer
{
QgsRelation relation;
relation.setName( name );
relation.setReferencingLayer( self->id() );
relation.setReferencingLayer( target->id() );
relation.setReferencedLayer( foundLayer->id() );
relation.addFieldPair( fkColumn, refColumn );
relation.generateId();
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.h
Expand Up @@ -220,7 +220,7 @@ class QgsPostgresProvider final: public QgsVectorDataProvider
*/
static QVariant convertValue( QVariant::Type type, QVariant::Type subType, const QString &value, const QString &typeName );

QList<QgsRelation> discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const override;
QList<QgsRelation> discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const override;
QgsAttrPalIndexNameHash palAttributeIndexNames() const override;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -5967,7 +5967,7 @@ QgsTransaction *QgsSpatiaLiteProvider::transaction( ) const
return static_cast<QgsTransaction *>( mTransaction );
}

QList<QgsRelation> QgsSpatiaLiteProvider::discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const
QList<QgsRelation> QgsSpatiaLiteProvider::discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const
{
QList<QgsRelation> output;
const QString sql = QStringLiteral( "PRAGMA foreign_key_list(%1)" ).arg( QgsSqliteUtils::quotedIdentifier( mTableName ) );
Expand All @@ -5994,7 +5994,7 @@ QList<QgsRelation> QgsSpatiaLiteProvider::discoverRelations( const QgsVectorLaye
{
QgsRelation relation;
relation.setName( name );
relation.setReferencingLayer( self->id() );
relation.setReferencingLayer( target->id() );
relation.setReferencedLayer( foundLayer->id() );
relation.addFieldPair( fkColumn, refColumn );
relation.generateId();
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialiteprovider.h
Expand Up @@ -144,7 +144,7 @@ class QgsSpatiaLiteProvider final: public QgsVectorDataProvider
QString description() const override;
QgsAttributeList pkAttributeIndexes() const override;
void invalidateConnections( const QString &connection ) override;
QList<QgsRelation> discoverRelations( const QgsVectorLayer *self, const QList<QgsVectorLayer *> &layers ) const override;
QList<QgsRelation> discoverRelations( const QgsVectorLayer *target, const QList<QgsVectorLayer *> &layers ) const override;

static QString providerKey();

Expand Down

0 comments on commit 13e355c

Please sign in to comment.