16#ifndef QGSLAYERTREEVIEW_H
17#define QGSLAYERTREEVIEW_H
36#include <QSortFilterProxyModel>
60 void setFilterText(
const QString &filterText = QString() );
65 bool showPrivateLayers()
const;
70 void setShowPrivateLayers(
bool showPrivate );
78 bool hideValidLayers()
const;
86 void setHideValidLayers(
bool hideValid );
90 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
98 bool mShowPrivateLayers =
false;
99 bool mHideValidLayers =
false;
124 if ( sipCpp->inherits(
"QgsLayerTreeView" ) )
125 sipType = sipType_QgsLayerTreeView;
140 void setModel( QAbstractItemModel *model )
override;
234 void setLayerVisible(
QgsMapLayer *layer,
bool visible );
264 QList<QgsLayerTreeNode *> selectedNodes(
bool skipInternal =
false )
const;
273 QList<QgsLayerTreeLayer *> selectedLayerNodes()
const;
282 QList<QgsMapLayer *> selectedLayers()
const;
292 QList<QgsLayerTreeModelLegendNode *> selectedLegendNodes()
const;
300 QList<QgsMapLayer *> selectedLayersRecursive()
const;
328 QList<QgsLayerTreeViewIndicator *> indicators(
QgsLayerTreeNode *node )
const;
348 static QStringList viewOnlyCustomProperties()
SIP_SKIP;
356 bool showPrivateLayers() const;
364 bool hideValidLayers() const;
368 void refreshLayerSymbology( const QString &layerId );
373 void expandAllNodes();
378 void collapseAllNodes();
385 void setLayerMarkWidth(
int width ) { mLayerMarkWidth = width; }
397 void setShowPrivateLayers(
bool showPrivate );
405 void setHideValidLayers(
bool hideValid );
424 void contextMenuEvent( QContextMenuEvent *event )
override;
428 QgsMapLayer *layerForIndex(
const QModelIndex &index )
const;
430 void mouseDoubleClickEvent( QMouseEvent *event )
override;
431 void mouseReleaseEvent( QMouseEvent *event )
override;
432 void keyPressEvent( QKeyEvent *event )
override;
434 void dragEnterEvent( QDragEnterEvent *event )
override;
435 void dragMoveEvent( QDragMoveEvent *event )
override;
436 void dropEvent( QDropEvent *event )
override;
438 void resizeEvent( QResizeEvent *event )
override;
442 void modelRowsInserted(
const QModelIndex &index,
int start,
int end );
443 void modelRowsRemoved();
445 void updateExpandedStateToNode(
const QModelIndex &index );
447 void onCurrentChanged();
454 void onHorizontalScroll(
int value );
456 void onDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles );
466 QHash< QgsLayerTreeNode *, QList<QgsLayerTreeViewIndicator *> >
mIndicators;
478 bool mShowPrivateLayers =
false;
479 bool mHideValidLayers =
false;
481 QTimer *mBlockDoubleClickTimer =
nullptr;
486 friend class QgsLayerTreeViewItemDelegate;
QgsLayerTreeFilterProxyModel is a sort filter proxy model to easily reproduce the legend/layer tree i...
Layer tree group node serves as a container for layers and further groups.
Layer tree node points to a map layer.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
The QgsLayerTreeModel class is model implementation for Qt item views framework.
This class is a base class for nodes in a layer tree.
The QgsLayerTreeProxyModel class is a proxy model for QgsLayerTreeModel, supports private layers and ...
The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together wit...
Indicator that can be used in a layer tree view to display icons next to items of the layer tree.
The QgsLayerTreeView class extends QTreeView and provides some additional functionality when working ...
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)