Class: QgsBrowserDockWidget

A dock widget containing a QgsBrowserWidget for navigating and managing data sources.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsBrowserDockWidget

Base classes

QgsDockWidget

A QDockWidget subclass with more fine-grained control over how the widget is closed or opened.

QDockWidget

QWidget

QObject

QPaintDevice

Methods

addFavorite

Add current item to favorite.

addFavoriteDirectory

Add directory to favorites.

addLayerAtIndex

Adds the layer corresponding to the specified model index.

addSelectedLayers

Add selected layers to the project

browserWidget

Returns a pointer to the QgsBrowserWidget used by the dock widget.

enablePropertiesWidget

Enable/disable properties widget.

hideItem

Hide current item.

mapCanvas

Returns the map canvas associated with the dock.

messageBar

Returns the message bar associated with the dock.

refresh

Refresh the browser model and view.

removeFavorite

Remove from favorite.

selectionChanged

Selection has changed.

setActiveIndex

Sets the selection to index and expand it.

setCaseSensitive

Sets filter case sensitivity.

setDisabledDataItemsKeys

Sets the customization for data items based on item's data provider key

setFilter

Apply filter to the model.

setFilterSyntax

Sets filter syntax.

setMapCanvas

Sets a map canvas to use alongside the dock.

setMessageBar

Sets a message bar to use alongside the dock widget.

showContextMenu

Show context menu.

showFilterWidget

Show/hide filter widget.

showProperties

Show the layer properties.

splitterMoved

Splitter has been moved.

toggleFastScan

Toggle fast scan

updateProjectHome

Update project home directory.

Signals

connectionsChanged

Connections changed in the browser

handleDropUriList

Emitted when drop uri list needs to be handled

openFile

Emitted when a file needs to be opened

class qgis.gui.QgsBrowserDockWidget[source]

Bases: QgsDockWidget

__init__(name: str | None, browserModel: QgsBrowserGuiModel | None, parent: QWidget | None = None)

Constructor for QgsBrowserDockWidget

Parameters:
  • name (Optional[str]) – name of the widget

  • browserModel (Optional[QgsBrowserGuiModel]) – instance of the (shared) browser model

  • parent (Optional[QWidget] = None) – parent widget

addFavorite(self)[source]

Add current item to favorite.

Deprecated since version 3.40: Will be removed in QGIS 4.0 - use the methods in QgsBrowserModel instead.

addFavoriteDirectory(self, favDir: str | None, name: str | None = '')[source]

Add directory to favorites.

Deprecated since version 3.40: Will be removed in QGIS 4.0 - use the methods in QgsBrowserModel instead.

Parameters:
  • favDir (Optional[str])

  • name (Optional[str] = '')

addFavoriteDirectory(self)[source]

Add directory from file dialog to favorite.

Deprecated since version 3.40: Will be removed in QGIS 4.0 - use the methods in QgsBrowserModel instead.

addLayerAtIndex(self, index: QModelIndex) bool[source]

Adds the layer corresponding to the specified model index.

Returns True if the index was successfully intrepreted as a map layer and loaded, or False if the index is not a map layer or could not be loaded.

Deprecated since version 3.40: Will be removed in QGIS 4.0 - retrieve the QgsLayerItem itself and manually add to project.

Parameters:

index (QModelIndex)

Return type:

bool

addSelectedLayers(self)[source]

Add selected layers to the project

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

browserWidget(self) QgsBrowserWidget | None[source]

Returns a pointer to the QgsBrowserWidget used by the dock widget.

Added in version 3.22.

Return type:

Optional[QgsBrowserWidget]

signal connectionsChanged[source]

Connections changed in the browser

enablePropertiesWidget(self, enable: bool)[source]

Enable/disable properties widget.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

enable (bool)

signal handleDropUriList(uris: QgsMimeDataUtils.UriList)[source]

Emitted when drop uri list needs to be handled

Parameters:

uris (QgsMimeDataUtils.UriList)

hideItem(self)[source]

Hide current item.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

mapCanvas(self) QgsMapCanvas | None[source]

Returns the map canvas associated with the dock.

See also

setMapCanvas()

Added in version 3.44.

Return type:

Optional[QgsMapCanvas]

messageBar(self) QgsMessageBar | None[source]

Returns the message bar associated with the dock.

See also

setMessageBar()

Added in version 3.6.

Return type:

Optional[QgsMessageBar]

signal openFile(fileName: str, fileTypeHint: str | None = None)[source]

Emitted when a file needs to be opened

Parameters:
  • fileName (str)

  • fileTypeHint (Optional[str] = None)

refresh(self)[source]

Refresh the browser model and view.

removeFavorite(self)[source]

Remove from favorite.

Deprecated since version 3.40: Will be removed in QGIS 4.0 - use the methods in QgsBrowserModel instead.

selectionChanged(self, selected: QItemSelection, deselected: QItemSelection)[source]

Selection has changed.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:
  • selected (QItemSelection)

  • deselected (QItemSelection)

setActiveIndex(self, index: QModelIndex)[source]

Sets the selection to index and expand it.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

index (QModelIndex)

setCaseSensitive(self, caseSensitive: bool)[source]

Sets filter case sensitivity.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

caseSensitive (bool)

setDisabledDataItemsKeys(self, filter: Iterable[str | None])[source]

Sets the customization for data items based on item’s data provider key

By default browser model shows all items from all available data items provider and few special items (e.g. Favorites). To customize the behavior, set the filter to not load certain data items. The items that are not based on data item providers (e.g. Favorites, Home) have prefix “special:”

Used in the proxy browser model to hide items

Added in version 3.12.

Parameters:

filter (Iterable[Optional[str]])

setFilter(self)[source]

Apply filter to the model.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

setFilterSyntax(self, a0: QAction | None)[source]

Sets filter syntax.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

a0 (Optional[QAction])

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets a map canvas to use alongside the dock.

Setting this allows items to utilize the canvas during GUI operations.

See also

mapCanvas()

Added in version 3.44.

Parameters:

canvas (Optional[QgsMapCanvas])

setMessageBar(self, bar: QgsMessageBar | None)[source]

Sets a message bar to use alongside the dock widget. Setting this allows items to utilize the message bar to provide non-blocking feedback to users, e.g. success or failure of actions.

See also

messageBar()

Added in version 3.6.

Parameters:

bar (Optional[QgsMessageBar])

showContextMenu(self, a0: QPoint)[source]

Show context menu.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

a0 (QPoint)

showFilterWidget(self, visible: bool)[source]

Show/hide filter widget.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

Parameters:

visible (bool)

showProperties(self)[source]

Show the layer properties.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.

splitterMoved(self)[source]

Splitter has been moved.

Deprecated since version 3.40: No longer used.

toggleFastScan(self)[source]

Toggle fast scan

Deprecated since version 3.40: Will be removed in QGIS 4.0.

updateProjectHome(self)[source]

Update project home directory.

Deprecated since version 3.40: Will be removed in QGIS 4.0 – this method is not intended for public use.