16 #ifndef QGSLAYERTREEMODEL_H 17 #define QGSLAYERTREEMODEL_H 19 #include <QAbstractItemModel> 79 ShowSymbology = 0x0001,
80 ShowRasterPreviewIcon = 0x0002,
81 ShowLegendAsTree = 0x0004,
82 DeferredLegendInvalidation = 0x0008,
85 AllowNodeReorder = 0x1000,
86 AllowNodeRename = 0x2000,
87 AllowNodeChangeVisibility = 0x4000,
88 AllowLegendChangeState = 0x8000,
89 AllowSymbologyChangeState = 0x8000,
91 Q_DECLARE_FLAGS( Flags,
Flag )
96 void setFlag(
Flag f,
bool on = true );
100 bool testFlag(
Flag f ) const;
110 QList<
QgsLayerTreeNode*> indexes2nodes( const QModelIndexList& list,
bool skipInternal = false ) const;
152 void setCurrentIndex( const
QModelIndex& currentIndex );
155 void setLayerTreeNodeFont(
int nodeType, const
QFont& font );
157 QFont layerTreeNodeFont(
int nodeType ) const;
160 void setAutoCollapseLegendNodes(
int nodeCount ) { mAutoCollapseLegendNodesCount = nodeCount; }
167 void setLegendFilterByScale(
double scaleDenominator );
195 void setLegendMapViewData(
double mapUnitsPerPixel,
int dpi,
double scale );
199 void legendMapViewData(
double *mapUnitsPerPixel,
int *dpi,
double *scale );
210 Q_DECL_DEPRECATED
bool isIndexSymbologyNode(
const QModelIndex& index )
const;
224 void nodeWillAddChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
225 void nodeAddedChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
226 void nodeWillRemoveChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
227 void nodeRemovedChildren();
233 void nodeLayerLoaded();
234 void nodeLayerWillBeUnloaded();
235 void layerLegendChanged();
237 void layerNeedsUpdate();
239 void legendNodeDataChanged();
241 void invalidateLegendMapBasedData();
252 void connectToRootNode();
253 void disconnectFromRootNode();
258 static const QIcon& iconGroup();
274 void legendCleanup();
275 void legendInvalidateMapBasedData();
340 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayerTreeModel::Flags )
342 #endif // QGSLAYERTREEMODEL_H Class for parsing and evaluation of expressions (formerly called "search strings").
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.
Q_DECL_DEPRECATED const QgsMapSettings * legendFilterByMap() const
Returns the current map settings used for legend filtering.
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.
A geometry is the spatial representation of a feature.
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...
QTimer mDeferLegendInvalidationTimer
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 * legendFilterMapSettings() const
Returns the current map settings used for the current legend filter (or null if none is enabled) ...
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
QScopedPointer< QgsMapHitTest > mLegendFilterHitTest
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)
QScopedPointer< QgsMapSettings > mLegendFilterMapSettings
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.