16 #ifndef QGSLAYERTREEMODEL_H
17 #define QGSLAYERTREEMODEL_H
19 #include <QAbstractItemModel>
76 ShowSymbology = 0x0001,
77 ShowRasterPreviewIcon = 0x0002,
78 ShowLegendAsTree = 0x0004,
81 AllowNodeReorder = 0x1000,
82 AllowNodeRename = 0x2000,
83 AllowNodeChangeVisibility = 0x4000,
84 AllowLegendChangeState = 0x8000,
85 AllowSymbologyChangeState = 0x8000,
87 Q_DECLARE_FLAGS( Flags, Flag )
90 void setFlags( Flags f );
92 void setFlag( Flag f,
bool on = true );
96 bool testFlag( Flag f ) const;
106 QList<
QgsLayerTreeNode*> indexes2nodes( const QModelIndexList& list,
bool skipInternal = false ) const;
133 void setCurrentIndex( const
QModelIndex& currentIndex );
136 void setLayerTreeNodeFont(
int nodeType, const
QFont& font );
138 QFont layerTreeNodeFont(
int nodeType ) const;
141 void setAutoCollapseLegendNodes(
int nodeCount ) { mAutoCollapseLegendNodesCount = nodeCount; }
148 void setLegendFilterByScale(
double scaleDenominator );
161 void setLegendMapViewData(
double mapUnitsPerPixel,
int dpi,
double scale );
165 void legendMapViewData(
double *mapUnitsPerPixel,
int *dpi,
double *scale );
176 Q_DECL_DEPRECATED
bool isIndexSymbologyNode(
const QModelIndex& index )
const;
190 void nodeWillAddChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
191 void nodeAddedChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
192 void nodeWillRemoveChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
193 void nodeRemovedChildren();
199 void nodeLayerLoaded();
200 void nodeLayerWillBeUnloaded();
201 void layerLegendChanged();
203 void layerNeedsUpdate();
205 void legendNodeDataChanged();
216 void connectToRootNode();
217 void disconnectFromRootNode();
222 static const QIcon& iconGroup();
238 void legendCleanup();
239 void legendInvalidateMapBasedData();
300 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayerTreeModel::Flags )
302 #endif // QGSLAYERTREEMODEL_H
Layer tree group node serves as a container for layers and further groups.
double mLegendMapViewMupp
QList< QgsLayerTreeModelLegendNode * > originalNodes
Data structure for storage of legend nodes.
virtual int rowCount(const QModelIndex &parent) const =0
Base class for all map layer types.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
double legendFilterByScale() const
LayerLegendTree * tree
Optional pointer to a tree structure - see LayerLegendTree for details.
Structure that stores tree representation of map layer's legend.
QScopedPointer< QgsMapSettings > mLegendFilterByMapSettings
QScopedPointer< QgsMapHitTest > mLegendFilterByMapHitTest
Flags mFlags
Set of flags for the model.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual QStringList mimeTypes() const
The QgsMapSettings class contains configuration for rendering of the map.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
QMap< QgsLayerTreeModelLegendNode *, QgsLayerTreeModelLegendNode * > parents
Pointer to parent for each active node. Top-level nodes have null parent. Pointers are not owned...
int autoCollapseLegendNodes() const
Return at what number of legend nodes the layer node should be collapsed. -1 means no auto-collapse (...
virtual Qt::DropActions supportedDropActions() const
This class is a base class for nodes in a layer tree.
QgsLayerTreeGroup * mRootNode
Pointer to the root node of the layer tree. Not owned by the model.
virtual QVariant data(const QModelIndex &index, int role) const =0
QMap< QgsLayerTreeModelLegendNode *, QList< QgsLayerTreeModelLegendNode * > > children
List of children for each active node. Top-level nodes are under null pointer key. Pointers are not owned.
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Class that runs a hit test with given map settings.
QPersistentModelIndex mCurrentIndex
Current index - will be underlined.
double mLegendMapViewScale
double mLegendFilterByScale
scale denominator for filtering of legend nodes (<= 0 means no filtering)
virtual bool removeRows(int row, int count, const QModelIndex &parent)
const QgsMapSettings * legendFilterByMap() const
int mAutoCollapseLegendNodesCount
Minimal number of nodes when legend should be automatically collapsed. -1 = disabled.
virtual int columnCount(const QModelIndex &parent) const =0
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
virtual Qt::ItemFlags flags(const QModelIndex &index) const
QList< QgsLayerTreeModelLegendNode * > activeNodes
Active legend nodes.
QMap< QString, QString > mLayerStyleOverrides
Overrides of map layers' styles: key = layer ID, value = style XML.
Q_DECL_DEPRECATED void refreshLayerSymbology(QgsLayerTreeLayer *nodeLayer)
Q_DECL_DEPRECATED void setAutoCollapseSymbologyNodes(int nodeCount)
QMap< QgsLayerTreeLayer *, LayerLegendData > mLegend
Per layer data about layer's legend nodes.
Layer tree node points to a map layer.
Q_DECL_DEPRECATED int autoCollapseSymbologyNodes() const
Structure that stores all data associated with one map layer.