Class: QgsAbstractDbTableModel

The QgsAbstractDbTableModel class is a pure virtual model class for results in a database source widget selector

Added in version 3.24.

Class Hierarchy

Inheritance diagram of qgis.core.QgsAbstractDbTableModel

Base classes

QStandardItemModel

QAbstractItemModel

QObject

Methods

columns

Returns the list of columns in the table

defaultSearchColumn

Returns the index of the column used by default to filter the results (probably the table name column if it exists)

searchableColumn

Returns if the column should be searchable at the given index

setSql

Sets an sql statement that belongs to a cell specified by a model index

class qgis.core.QgsAbstractDbTableModel[source]

Bases: QStandardItemModel

__init__(parent: QObject | None = None)

Constructor

Parameters:

parent (Optional[QObject] = None)

columns(self) List[str][source]

Returns the list of columns in the table

Return type:

List[str]

defaultSearchColumn(self) int[source]

Returns the index of the column used by default to filter the results (probably the table name column if it exists)

Return type:

int

searchableColumn(self, column: int) bool[source]

Returns if the column should be searchable at the given index

Parameters:

column (int)

Return type:

bool

setSql(self, index: QModelIndex, sql: str | None)[source]

Sets an sql statement that belongs to a cell specified by a model index

Parameters:
  • index (QModelIndex)

  • sql (Optional[str])