QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsElevationProfileLayerTreeView Class Reference

A layer tree view for elevation profiles. More...

#include <qgselevationprofilelayertreeview.h>

Inheritance diagram for QgsElevationProfileLayerTreeView:

Public Slots

void addNodeForRegisteredSource (const QString &sourceId, const QString &sourceName)
 Adds a custom node in the layer tree corresponding to a registered profile source.
void populateMissingLayers (QgsProject *project)
 Adds any layers from a project which currently aren't within the profile's layer tree.
void removeNodeForUnregisteredSource (const QString &sourceId)
 Removes a custom node from the layer tree corresponding to an unregistered profile source.
Public Slots inherited from QgsLayerTreeViewBase
void collapseAllNodes ()
 Enhancement of QTreeView::collapseAll() that also records expanded state in layer tree nodes.
void expandAllNodes ()
 Enhancement of QTreeView::expandAll() that also records expanded state in layer tree nodes.

Signals

void addLayers (const QList< QgsMapLayer * > &layers)
 Emitted when layers should be added to the profile, e.g.

Public Member Functions

 QgsElevationProfileLayerTreeView (QgsLayerTree *rootNode, QWidget *parent=nullptr)
 Construct a new tree view with given layer tree (root node must not be nullptr).
void populateInitialSources (QgsProject *project)
 Initially populates the tree view using layers from a project, as well as sources from the source registry.
QgsElevationProfileLayerTreeProxyModelproxyModel ()
 Returns the view's proxy model.
Public Member Functions inherited from QgsLayerTreeViewBase
 QgsLayerTreeViewBase (QWidget *parent=nullptr)
 Constructor for QgsLayerTreeViewBase.
 ~QgsLayerTreeViewBase () override
QgsLayerTreeGroupcurrentGroupNode () const
 Returns the current group node.
QgsMapLayercurrentLayer () const
 Returns the currently selected layer, or nullptr if no layers is selected.
QgsLayerTreeModelLegendNodecurrentLegendNode () const
 Gets current legend node.
QgsLayerTreeNodecurrentNode () const
 Returns the current node.
QgsLayerTreeViewDefaultActionsdefaultActions ()
 Gets access to the default actions that may be used with the tree view.
QgsLayerTreeModelLegendNodeindex2legendNode (const QModelIndex &index) const
 Returns legend node for given view index.
QgsLayerTreeNodeindex2node (const QModelIndex &index) const
 Returns the layer tree node for given view index.
QgsMapLayerlayerForIndex (const QModelIndex &index) const
 Returns the map layer corresponding to a view index.
QgsLayerTreeModellayerTreeModel () const
 Returns the associated layer tree model.
QModelIndex legendNode2index (QgsLayerTreeModelLegendNode *legendNode)
 Returns the view index for a given legend node.
QModelIndex legendNode2sourceIndex (QgsLayerTreeModelLegendNode *legendNode)
 Returns the layer tree source model index for a given legend node.
void mouseDoubleClickEvent (QMouseEvent *event) override
QModelIndex node2index (QgsLayerTreeNode *node) const
 Returns the view model index for a given node.
QModelIndex node2sourceIndex (QgsLayerTreeNode *node) const
 Returns the layer tree source model index for a given node.
QList< QgsLayerTreeLayer * > selectedLayerNodes () const
 Returns the list of selected nodes filtered to just layer nodes (QgsLayerTreeLayer).
QList< QgsMapLayer * > selectedLayers () const
 Returns the list of selected layers.
QList< QgsMapLayer * > selectedLayersRecursive () const
 Gets list of selected layers, including those that are not directly selected, but their ancestor groups is selected.
QList< QgsLayerTreeModelLegendNode * > selectedLegendNodes () const
 Returns the list of selected legend nodes.
QList< QgsLayerTreeNode * > selectedNodes (bool skipInternal=false) const
 Returns the list of selected layer tree nodes.
void setCurrentLayer (QgsMapLayer *layer)
 Sets the currently selected layer.
void setCurrentNode (QgsLayerTreeNode *node)
 Sets the currently selected node.
void setLayerTreeModel (QgsLayerTreeModel *model)
 Associates a layer tree model with the view.

Static Public Attributes

static const QString CUSTOM_NODE_ELEVATION_PROFILE_SOURCE = QStringLiteral( "elevationProfileRegistry" )

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
Protected Member Functions inherited from QgsLayerTreeViewBase
QModelIndex layerTreeModelIndexToViewIndex (const QModelIndex &index) const
 Returns the layer tree model index corresponding with a view index.
void updateExpandedStateFromNode (QgsLayerTreeNode *node)
 Updates the expanded state from a node.
QModelIndex viewIndexToLayerTreeModelIndex (const QModelIndex &index) const
 Returns the view index corresponding with a layer tree model index.

Additional Inherited Members

Protected Slots inherited from QgsLayerTreeViewBase
void onExpandedChanged (QgsLayerTreeNode *node, bool expanded)
 Called when the expanded state changes for a node.
void onModelReset ()
 Called when the model is reset.
void updateExpandedStateToNode (const QModelIndex &index)
 Stores the expanded state to a node with matching index.
Protected Attributes inherited from QgsLayerTreeViewBase
QgsLayerTreeViewDefaultActionsmDefaultActions = nullptr
 helper class with default actions. Lazily initialized.

Detailed Description

A layer tree view for elevation profiles.

Note
Not available in Python bindings
Since
QGIS 3.30

Definition at line 113 of file qgselevationprofilelayertreeview.h.

Constructor & Destructor Documentation

◆ QgsElevationProfileLayerTreeView()

QgsElevationProfileLayerTreeView::QgsElevationProfileLayerTreeView ( QgsLayerTree * rootNode,
QWidget * parent = nullptr )
explicit

Construct a new tree view with given layer tree (root node must not be nullptr).

The root node is not transferred by the view.

Definition at line 439 of file qgselevationprofilelayertreeview.cpp.

Member Function Documentation

◆ addLayers

void QgsElevationProfileLayerTreeView::addLayers ( const QList< QgsMapLayer * > & layers)
signal

Emitted when layers should be added to the profile, e.g.

via a drag and drop action.

Since
QGIS 3.32

◆ addNodeForRegisteredSource

void QgsElevationProfileLayerTreeView::addNodeForRegisteredSource ( const QString & sourceId,
const QString & sourceName )
slot

Adds a custom node in the layer tree corresponding to a registered profile source.

The created node can be accessed via the source id. If the source already has a corresponding node in the layer tree, a second node won't be created.

Parameters
sourceIdUnique identifier of the registered profile source.
sourceNameName of the registered profile source.
Since
QGIS 4.0

Definition at line 492 of file qgselevationprofilelayertreeview.cpp.

◆ populateInitialSources()

void QgsElevationProfileLayerTreeView::populateInitialSources ( QgsProject * project)

Initially populates the tree view using layers from a project, as well as sources from the source registry.

Definition at line 481 of file qgselevationprofilelayertreeview.cpp.

◆ populateMissingLayers

void QgsElevationProfileLayerTreeView::populateMissingLayers ( QgsProject * project)
slot

Adds any layers from a project which currently aren't within the profile's layer tree.

Since
QGIS 4.0

Definition at line 452 of file qgselevationprofilelayertreeview.cpp.

◆ proxyModel()

QgsElevationProfileLayerTreeProxyModel * QgsElevationProfileLayerTreeView::proxyModel ( )

Returns the view's proxy model.

Since
QGIS 3.32

Definition at line 509 of file qgselevationprofilelayertreeview.cpp.

◆ removeNodeForUnregisteredSource

void QgsElevationProfileLayerTreeView::removeNodeForUnregisteredSource ( const QString & sourceId)
slot

Removes a custom node from the layer tree corresponding to an unregistered profile source.

Parameters
sourceIdUnique identifier of the unregistered profile source.
Since
QGIS 4.0

Definition at line 504 of file qgselevationprofilelayertreeview.cpp.

◆ resizeEvent()

void QgsElevationProfileLayerTreeView::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 514 of file qgselevationprofilelayertreeview.cpp.

Member Data Documentation

◆ CUSTOM_NODE_ELEVATION_PROFILE_SOURCE

const QString QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE = QStringLiteral( "elevationProfileRegistry" )
static

Definition at line 118 of file qgselevationprofilelayertreeview.h.


The documentation for this class was generated from the following files: