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 );
74 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
82 bool mShowPrivateLayers =
false;
108 if ( sipCpp->inherits(
"QgsLayerTreeView" ) )
109 sipType = sipType_QgsLayerTreeView;
124 void setModel( QAbstractItemModel *model )
override;
218 void setLayerVisible(
QgsMapLayer *layer,
bool visible );
244 QList<QgsLayerTreeNode *> selectedNodes(
bool skipInternal =
false )
const;
246 QList<QgsLayerTreeLayer *> selectedLayerNodes()
const;
249 QList<QgsMapLayer *> selectedLayers()
const;
257 QList<QgsMapLayer *> selectedLayersRecursive()
const;
285 QList<QgsLayerTreeViewIndicator *> indicators(
QgsLayerTreeNode *node )
const;
305 static QStringList viewOnlyCustomProperties()
SIP_SKIP;
310 void refreshLayerSymbology( const QString &layerId );
316 void expandAllNodes();
322 void collapseAllNodes();
329 void setLayerMarkWidth(
int width ) { mLayerMarkWidth = width; }
341 void setShowPrivateLayers(
bool showPrivate );
347 bool showPrivateLayers( );
354 void contextMenuEvent( QContextMenuEvent *event )
override;
358 QgsMapLayer *layerForIndex(
const QModelIndex &index )
const;
360 void mouseReleaseEvent( QMouseEvent *event )
override;
361 void keyPressEvent( QKeyEvent *event )
override;
363 void dropEvent( QDropEvent *event )
override;
365 void resizeEvent( QResizeEvent *event )
override;
369 void modelRowsInserted(
const QModelIndex &index,
int start,
int end );
370 void modelRowsRemoved();
372 void updateExpandedStateToNode(
const QModelIndex &index );
374 void onCurrentChanged();
381 void onHorizontalScroll(
int value );
383 void onDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles );
393 QHash< QgsLayerTreeNode *, QList<QgsLayerTreeViewIndicator *> >
mIndicators;
405 bool mShowPrivateLayers =
false;
411 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.
QString mCurrentLayerID
Keeps track of current layer ID (to check when to emit signal about change of current layer)
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.
QgsLayerTreeModelLegendNode * legendNode(const QString &rule, QgsLayerTreeModel &model)
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)