Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add pure virtual QgsAbstractDbTableModel::setSql
  • Loading branch information
3nids committed Nov 12, 2021
1 parent efb89f8 commit 93bdf53
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 7 deletions.
Expand Up @@ -39,6 +39,11 @@ Returns the index of the column used by default to filter the results (probably
virtual bool searchableColumn( int column ) const;
%Docstring
Returns if the column should be searchable at the given index
%End

virtual void setSql( const QModelIndex &index, const QString &sql ) = 0;
%Docstring
Sets an sql statement that belongs to a cell specified by a model index
%End
};

Expand Down
3 changes: 3 additions & 0 deletions src/core/providers/qgsabstractdbtablemodel.h
Expand Up @@ -42,6 +42,9 @@ class CORE_EXPORT QgsAbstractDbTableModel : public QStandardItemModel

//! Returns if the column should be searchable at the given index
virtual bool searchableColumn( int column ) const {Q_UNUSED( column ) return true;}

//! Sets an sql statement that belongs to a cell specified by a model index
virtual void setSql( const QModelIndex &index, const QString &sql ) = 0;
};

#endif // QGSABSTRACTDBTABLEMODEL_H
2 changes: 1 addition & 1 deletion src/gui/providers/ogr/qgsogrdbtablemodel.h
Expand Up @@ -46,7 +46,7 @@ class QgsOgrDbTableModel : public QgsAbstractDbTableModel
void addTableEntry( const Qgis::BrowserLayerType &layerType, const QString &tableName, const QString &uri, const QString &geometryColName, const QString &geometryType, const QString &sql );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

//! Returns the number of tables in the model
int tableCount() const
Expand Down
2 changes: 1 addition & 1 deletion src/providers/db2/qgsdb2tablemodel.h
Expand Up @@ -62,7 +62,7 @@ class QgsDb2TableModel : public QgsAbstractDbTableModel
void addTableEntry( const QgsDb2LayerProperty &property );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

/**
* Sets one or more geometry types to a row. In case of several types, additional rows are inserted.
Expand Down
2 changes: 1 addition & 1 deletion src/providers/hana/qgshanatablemodel.h
Expand Up @@ -77,7 +77,7 @@ class QgsHanaTableModel : public QgsAbstractDbTableModel
void addTableEntry( const QString &connName, const QgsHanaLayerProperty &property );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

//! Returns the number of tables in the model
int tableCount() const { return mTableCount; }
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqltablemodel.h
Expand Up @@ -59,7 +59,7 @@ class QgsMssqlTableModel : public QgsAbstractDbTableModel
void addTableEntry( const QgsMssqlLayerProperty &property );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

/**
* Sets one or more geometry types to a row. In case of several types, additional rows are inserted.
Expand Down
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoracletablemodel.h
Expand Up @@ -44,7 +44,7 @@ class QgsOracleTableModel : public QgsAbstractDbTableModel
void addTableEntry( const QgsOracleLayerProperty &property );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

//! Returns the number of tables in the model
int tableCount() const { return mTableCount; }
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspgtablemodel.h
Expand Up @@ -39,7 +39,7 @@ class QgsPgTableModel : public QgsAbstractDbTableModel
void addTableEntry( const QgsPostgresLayerProperty &property );

//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

//! Returns the number of tables in the model
int tableCount() const { return mTableCount; }
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialitetablemodel.h
Expand Up @@ -43,7 +43,7 @@ class QgsSpatiaLiteTableModel: public QgsAbstractDbTableModel
//! Adds entry for one database table to the model
void addTableEntry( const QString &type, const QString &tableName, const QString &geometryColName, const QString &sql );
//! Sets an sql statement that belongs to a cell specified by a model index
void setSql( const QModelIndex &index, const QString &sql );
void setSql( const QModelIndex &index, const QString &sql ) override;

/**
* Sets one or more geometry types to a row. In case of several types, additional rows are inserted.
Expand Down

0 comments on commit 93bdf53

Please sign in to comment.