Class: QgsAbstractDbSourceSelect

Base class for database source widget selectors.

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: setSql()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAbstractDbSourceSelect

Base classes

QgsAbstractDataSourceWidget

Abstract base class for Data Source widgets to create connections and add layers.

QDialog

QWidget

QObject

QPaintDevice

Abstract Methods

setSql

This is called to define the SQL query and must be re-implemented.

Methods

init

Sets the source model for the table and optionally a delegate

proxyModel

Returns the proxy model used to filter the results

storeSettings

Stores the settings made in the gui

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsAbstractDbSourceSelect. See the FAQ for more details.

settingPath

Returns the setting path of the derived source select

treeviewClicked

Called on click for the source index

treeviewDoubleClicked

Called on double-click for the source index

class qgis.gui.QgsAbstractDbSourceSelect[source]

Bases: QgsAbstractDataSourceWidget

__init__(parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = QgsGuiUtils.ModalDialogFlags, widgetMode: QgsProviderRegistry.WidgetMode = QgsProviderRegistry.WidgetMode.Standalone)

Constructor

Parameters:
  • parent (Optional[QWidget] = None)

  • fl (Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)

  • widgetMode (QgsProviderRegistry.WidgetMode = QgsProviderRegistry.WidgetMode.Standalone)

init(self, model: QgsAbstractDbTableModel | None, delegate: QItemDelegate | None = None)[source]

Sets the source model for the table and optionally a delegate

Parameters:
proxyModel(self) QSortFilterProxyModel | None[source]

Returns the proxy model used to filter the results

Return type:

Optional[QSortFilterProxyModel]

abstract setSql(self, index: QModelIndex)[source]

This is called to define the SQL query and must be re-implemented. The implementation should call QgsAbstractDbTableModel.setSql The index is in the source model.

Parameters:

index (QModelIndex)

virtual settingPath(self) str[source]

Returns the setting path of the derived source select

Return type:

str

Returns:

setting path

Note

Might be pure virtual in QGIS 5.x

Added in version 3.44.

storeSettings(self)[source]

Stores the settings made in the gui

Added in version 3.44.

virtual treeviewClicked(self, index: QModelIndex)[source]

Called on click for the source index

Parameters:

index (QModelIndex)

virtual treeviewDoubleClicked(self, index: QModelIndex)[source]

Called on double-click for the source index

Parameters:

index (QModelIndex)