Class: QgsProviderConnectionComboBox

The QgsProviderConnectionComboBox class is a combo box which displays the list of connections registered for a given provider.

Warning

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

Added in version 3.14.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsProviderConnectionComboBox

Base classes

QComboBox

QWidget

QObject

QPaintDevice

Methods

allowEmptyConnection

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

currentConnection

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

currentConnectionUri

Returns the uri of the current connection selected in the combo box.

setAllowEmptyConnection

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

setConnection

Sets the current connection selected in the combo box.

setProvider

Sets the provider to be used.

Signals

connectionChanged

Emitted whenever the currently selected connection changes.

class qgis.gui.QgsProviderConnectionComboBox[source]

Bases: QComboBox

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

Constructor for QgsProviderConnectionComboBox, for the specified provider.

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

  • parent (Optional[QWidget] = None)

allowEmptyConnection(self) bool[source]

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

Return type:

bool

signal connectionChanged(connection: str)[source]

Emitted whenever the currently selected connection changes.

Parameters:

connection (str)

currentConnection(self) str[source]

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

Return type:

str

currentConnectionUri(self) str[source]

Returns the uri of the current connection selected in the combo box.

Return type:

str

setAllowEmptyConnection(self, allowEmpty: bool)[source]

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

Parameters:

allowEmpty (bool)

setConnection(self, connection: str | None)[source]

Sets the current connection selected in the combo box.

Parameters:

connection (Optional[str])

setProvider(self, provider: str | None)[source]

Sets the provider to be used.

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