16#ifndef QGSLAYERTREEVIEW_H
17#define QGSLAYERTREEVIEW_H
36#include <QSortFilterProxyModel>
59 void setFilterText(
const QString &filterText = QString() );
64 bool showPrivateLayers()
const;
69 void setShowPrivateLayers(
bool showPrivate );
77 bool hideValidLayers()
const;
85 void setHideValidLayers(
bool hideValid );
88 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
95 bool mShowPrivateLayers =
false;
96 bool mHideValidLayers =
false;
118 if ( sipCpp->inherits(
"QgsLayerTreeView" ) )
119 sipType = sipType_QgsLayerTreeView;
133 void setModel( QAbstractItemModel *model )
override;
227 void setLayerVisible(
QgsMapLayer *layer,
bool visible );
267 QList<QgsLayerTreeNode *> selectedNodes(
bool skipInternal =
false )
const;
276 QList<QgsLayerTreeLayer *> selectedLayerNodes()
const;
285 QList<QgsMapLayer *> selectedLayers()
const;
295 QList<QgsLayerTreeModelLegendNode *> selectedLegendNodes()
const;
303 QList<QgsMapLayer *> selectedLayersRecursive()
const;
331 QList<QgsLayerTreeViewIndicator *> indicators(
QgsLayerTreeNode *node )
const;
351 static QStringList viewOnlyCustomProperties()
SIP_SKIP;
359 bool showPrivateLayers() const;
367 bool hideValidLayers() const;
371 void refreshLayerSymbology( const QString &layerId );
376 void expandAllNodes();
381 void collapseAllNodes();
388 void setLayerMarkWidth(
int width ) { mLayerMarkWidth = width; }
400 void setShowPrivateLayers(
bool showPrivate );
408 void setHideValidLayers(
bool hideValid );
427 void contextMenuEvent( QContextMenuEvent *event )
override;
431 QgsMapLayer *layerForIndex(
const QModelIndex &index )
const;
433 void mouseDoubleClickEvent( QMouseEvent *event )
override;
434 void mouseReleaseEvent( QMouseEvent *event )
override;
435 void keyPressEvent( QKeyEvent *event )
override;
437 void dragEnterEvent( QDragEnterEvent *event )
override;
438 void dragMoveEvent( QDragMoveEvent *event )
override;
439 void dropEvent( QDropEvent *event )
override;
441 void resizeEvent( QResizeEvent *event )
override;
445 void modelRowsInserted(
const QModelIndex &index,
int start,
int end );
446 void modelRowsRemoved();
448 void updateExpandedStateToNode(
const QModelIndex &index );
450 void onCurrentChanged();
457 void onHorizontalScroll(
int value );
459 void onDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles );
469 QHash<QgsLayerTreeNode *, QList<QgsLayerTreeViewIndicator *>>
mIndicators;
481 bool mShowPrivateLayers =
false;
482 bool mHideValidLayers =
false;
484 QTimer *mBlockDoubleClickTimer =
nullptr;
489 friend class QgsLayerTreeViewItemDelegate;
A sort filter proxy model to easily reproduce the legend/layer tree in a tree view.
Layer tree group node serves as a container for layers and further groups.
Layer tree node points to a map layer.
An abstract interface for legend items returned from QgsMapLayerLegend implementation.
A model representing the layer tree, including layers and groups of layers.
Base class for nodes in a layer tree.
A proxy model for QgsLayerTreeModel, supporting private layers and text filtering.
Serves as a factory of actions that can be used together with a layer tree view.
Indicator that can be used in a layer tree view to display icons next to items of the layer tree.
Extends QTreeView and provides additional functionality when working with a layer tree.
int mLayerMarkWidth
Width of contextual menu mark for layer nodes.
void currentLayerChanged(QgsMapLayer *layer)
Emitted when a current layer is changed.
void contextMenuAboutToShow(QMenu *menu)
Emitted when the context menu is about to show.
QString mCurrentLayerID
Keeps track of current layer ID (to check when to emit signal about change of current layer)
void datasetsDropped(QDropEvent *event)
Emitted when datasets are dropped onto the layer tree view.
QHash< QgsLayerTreeNode *, QList< QgsLayerTreeViewIndicator * > > mIndicators
Storage of indicators used with the tree view.
QgsLayerTreeViewMenuProvider * menuProvider() const
Returns pointer to the context menu provider. May be nullptr.
QPoint mLastReleaseMousePos
Used by the item delegate for identification of which indicator has been clicked.
int layerMarkWidth() const
Returns width of contextual menu mark, at right of layer node items.
Base class for all map layer types.
A bar for displaying non-blocking messages to the user.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)