Class: QgsDatabaseSchemaModel¶
- class qgis.core.QgsDatabaseSchemaModel¶
Bases:
PyQt5.QtCore.QAbstractItemModel
A model containing schemas from a database connection.
This class does not automatically subscribe to database updates. Schemas are queried from the database initially upon model construction. In order to update the listed schemas,
QgsDatabaseSchemaModel.refresh()
must be manually called.New in version 3.14.
QgsDatabaseSchemaModel(provider: str, connection: str, parent: QObject = None) Constructor for
QgsDatabaseSchemaModel
, for the specifiedprovider
andconnection
name.Warning
The
provider
must support the connection API methods in itsQgsProviderMetadata
implementation in order for the model to work correctly.QgsDatabaseSchemaModel(connection:
QgsAbstractDatabaseProviderConnection
, parent: QObject = None) Constructor forQgsDatabaseSchemaModel
, for the specifiedconnection
.Ownership of
connection
is transferred to the model.Methods
Returns
True
if the model allows the empty schema ("not set") choice.beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
changePersistentIndex
- param parent:
createIndex
- param index:
decodeData
- param row:
- param child:
Refreshes the schema list by querying the underlying connection.
- param parent:
Sets whether an optional empty schema ("not set") option is present in the model.
Attributes
- class Role¶
Bases:
int
- RoleEmpty = 256¶
- allowEmptySchema(self) bool ¶
Returns
True
if the model allows the empty schema (“not set”) choice.See also
- Return type:
bool
- QgsDatabaseSchemaModel.beginInsertColumns(self, QModelIndex, int, int)
- QgsDatabaseSchemaModel.beginInsertRows(self, QModelIndex, int, int)
- QgsDatabaseSchemaModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsDatabaseSchemaModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsDatabaseSchemaModel.beginRemoveColumns(self, QModelIndex, int, int)
- QgsDatabaseSchemaModel.beginRemoveRows(self, QModelIndex, int, int)
- beginResetModel(self)¶
- QgsDatabaseSchemaModel.changePersistentIndex(self, QModelIndex, QModelIndex)
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- connectNotify(self, QMetaMethod)¶
- QgsDatabaseSchemaModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
- customEvent(self, QEvent)¶
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- Parameters:
index (QModelIndex) –
role (int = Qt.DisplayRole) –
- Return type:
Any
- QgsDatabaseSchemaModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
- disconnectNotify(self, QMetaMethod)¶
- encodeData(self, Iterable[QModelIndex], QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- index(self, row: int, column: int, parent: QModelIndex) QModelIndex ¶
- Parameters:
row (int) –
column (int) –
parent (QModelIndex) –
- Return type:
QModelIndex
- isSignalConnected(self, QMetaMethod) bool ¶
- parent(self, child: QModelIndex) QModelIndex ¶
- Parameters:
child (QModelIndex) –
- Return type:
QModelIndex
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, PYQT_SIGNAL) int ¶
- refresh(self)¶
Refreshes the schema list by querying the underlying connection.
- resetInternalData(self)¶
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex()) –
- Return type:
int
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setAllowEmptySchema(self, allowEmpty: bool)¶
Sets whether an optional empty schema (“not set”) option is present in the model.
See also
- Parameters:
allowEmpty (bool) –
- timerEvent(self, QTimerEvent)¶