Class: QgsDatabaseSchemaComboBox

The QgsDatabaseSchemaComboBox class is a combo box which displays the list of schemas for a specific database connection.

Warning

The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the combobox to work correctly.

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsDatabaseSchemaComboBox

Base classes

QWidget

QObject

QPaintDevice

Methods

allowEmptySchema

Returns True if the combobox allows the empty schema ("not set") choice.

comboBox

Returns the combobox portion of the widget.

currentSchema

Returns the name of the current schema selected in the combo box.

refreshSchemas

Refreshes the list of available schemas.

setAllowEmptySchema

Sets whether an optional empty schema ("not set") option is present in the combobox.

setConnectionName

Sets the database connection name from which to retrieve the available schemas.

setSchema

Sets the current schema selected in the combo box.

Signals

schemaChanged

Emitted whenever the currently selected schema changes.

class qgis.gui.QgsDatabaseSchemaComboBox[source]

Bases: QWidget

__init__(provider: str | None, connection: str | None, parent: QWidget | None = None)

Constructor for QgsDatabaseSchemaComboBox, for the specified provider and connection.

Warning

The provider must support the connection API methods in its QgsProviderMetadata implementation in order for the model to work correctly.

Parameters:
  • provider (Optional[str])

  • connection (Optional[str])

  • parent (Optional[QWidget] = None)

__init__(connection: QgsAbstractDatabaseProviderConnection | None, parent: QWidget | None = None)

Constructor for QgsDatabaseSchemaComboBox, for the specified connection.

Ownership of connection is transferred to the combobox.

Parameters:
allowEmptySchema(self) bool[source]

Returns True if the combobox allows the empty schema (“not set”) choice.

Return type:

bool

comboBox(self) QComboBox | None[source]

Returns the combobox portion of the widget.

Return type:

Optional[QComboBox]

currentSchema(self) str[source]

Returns the name of the current schema selected in the combo box.

Return type:

str

refreshSchemas(self)[source]

Refreshes the list of available schemas.

signal schemaChanged(schema: str)[source]

Emitted whenever the currently selected schema changes.

Parameters:

schema (str)

setAllowEmptySchema(self, allowEmpty: bool)[source]

Sets whether an optional empty schema (“not set”) option is present in the combobox.

Parameters:

allowEmpty (bool)

setConnectionName(self, connection: str | None, provider: str | None = '')[source]

Sets the database connection name from which to retrieve the available schemas.

Optionally the provider can be reset too.

Parameters:
  • connection (Optional[str])

  • provider (Optional[str] = '')

setSchema(self, schema: str | None)[source]

Sets the current schema selected in the combo box.

Parameters:

schema (Optional[str])