Class: QgsBrowserTreeView

The QgsBrowserTreeView class extends QTreeView with save/restore tree state functionality.

See also

QgsBrowserModel

Class Hierarchy

Inheritance diagram of qgis.gui.QgsBrowserTreeView

Base classes

QTreeView

QAbstractItemView

QAbstractScrollArea

QFrame

QWidget

QObject

QPaintDevice

Methods

browserModel

Returns the browser model

expandPath

Expands out a file path in the view.

hasExpandedDescendant

setBrowserModel

Sets the browser model

setSelectedItem

Sets the item currently selected in the view.

setSettingsSection

class qgis.gui.QgsBrowserTreeView[source]

Bases: QTreeView

__init__(parent: QWidget | None = None)

Constructor for QgsBrowserTreeView

Parameters:

parent (Optional[QWidget] = None)

browserModel(self) QgsBrowserGuiModel | None[source]

Returns the browser model

Return type:

Optional[QgsBrowserGuiModel]

expandPath(self, path: str | None, selectPath: bool = False)[source]

Expands out a file path in the view.

The path must correspond to a valid directory existing on the file system.

Since QGIS 3.38 the selectPath argument can be used to automatically select the path too.

Added in version 3.28.

Parameters:
  • path (Optional[str])

  • selectPath (bool = False)

hasExpandedDescendant(self, index: QModelIndex) bool[source]
Parameters:

index (QModelIndex)

Return type:

bool

setBrowserModel(self, model: QgsBrowserGuiModel | None)[source]

Sets the browser model

Parameters:

model (Optional[QgsBrowserGuiModel])

setSelectedItem(self, item: QgsDataItem | None) bool[source]

Sets the item currently selected in the view.

Returns True if the item was found and could be selected.

Added in version 3.28.

Parameters:

item (Optional[QgsDataItem])

Return type:

bool

setSettingsSection(self, section: str | None)[source]
Parameters:

section (Optional[str])