Class: QgsAbstractDbTableModel

Pure virtual model class for results in a database source widget selector.

Added in version 3.24.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: columns(), defaultSearchColumn(), setSql()

Class Hierarchy

Inheritance diagram of qgis.core.QgsAbstractDbTableModel

Base classes

QStandardItemModel

QAbstractItemModel

QObject

class qgis.core.QgsAbstractDbTableModel[source]

Bases: QStandardItemModel

__init__(parent: QObject | None = None)

Constructor

Parameters:

parent (Optional[QObject] = None)

abstract columns(self) List[str][source]

Returns the list of columns in the table

Return type:

List[str]

abstract 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

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

Returns if the column should be searchable at the given index

Parameters:

column (int)

Return type:

bool

abstract 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])