16 #ifndef QGSLAYERTREEMODEL_H 17 #define QGSLAYERTREEMODEL_H 19 #include <QAbstractItemModel> 79 ShowSymbology = 0x0001,
80 ShowRasterPreviewIcon = 0x0002,
81 ShowLegendAsTree = 0x0004,
82 DeferredLegendInvalidation = 0x0008,
83 UseEmbeddedWidgets = 0x0010,
86 AllowNodeReorder = 0x1000,
87 AllowNodeRename = 0x2000,
88 AllowNodeChangeVisibility = 0x4000,
89 AllowLegendChangeState = 0x8000,
90 AllowSymbologyChangeState = 0x8000,
92 Q_DECLARE_FLAGS( Flags,
Flag )
95 void setFlags(
const QgsLayerTreeModel::Flags& f );
97 void setFlag(
Flag f,
bool on =
true );
101 bool testFlag(
Flag f )
const;
159 void setCurrentIndex(
const QModelIndex& currentIndex );
162 void setLayerTreeNodeFont(
int nodeType,
const QFont& font );
164 QFont layerTreeNodeFont(
int nodeType )
const;
174 void setLegendFilterByScale(
double scaleDenominator );
202 void setLegendMapViewData(
double mapUnitsPerPixel,
int dpi,
double scale );
206 void legendMapViewData(
double *mapUnitsPerPixel,
int *dpi,
double *scale );
217 Q_DECL_DEPRECATED
bool isIndexSymbologyNode(
const QModelIndex& index )
const;
231 void nodeWillAddChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
232 void nodeAddedChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
233 void nodeWillRemoveChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
234 void nodeRemovedChildren();
243 void nodeLayerLoaded();
244 void nodeLayerWillBeUnloaded();
245 void layerLegendChanged();
247 void layerNeedsUpdate();
249 void legendNodeDataChanged();
251 void invalidateLegendMapBasedData();
262 void connectToRootNode();
263 void disconnectFromRootNode();
274 static const QIcon& iconGroup();
290 void legendCleanup();
291 void legendInvalidateMapBasedData();
322 : embeddedNodeInParent( nullptr )
369 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayerTreeModel::Flags )
371 #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.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const=0
LayerLegendTree * tree
Optional pointer to a tree structure - see LayerLegendTree for details.
Structure that stores tree representation of map layer's legend.
QgsLayerTreeModelLegendNode * embeddedNodeInParent
A legend node that is not displayed separately, its icon is instead shown within the layer node's ite...
A geometry is the spatial representation of a feature.
bool mLegendFilterUsesExtent
whether to use map filtering
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
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
int autoCollapseLegendNodes() const
Return at what number of legend nodes the layer node should be collapsed. -1 means no auto-collapse (...
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.
Q_DECL_DEPRECATED const QgsMapSettings * legendFilterByMap() const
Returns the current map settings used for legend filtering.
Q_DECL_DEPRECATED int autoCollapseSymbologyNodes() const
QPersistentModelIndex mCurrentIndex
Current index - will be underlined.
double mLegendMapViewScale
double mLegendFilterByScale
scale denominator for filtering of legend nodes (<= 0 means no filtering)
const QgsMapSettings * legendFilterMapSettings() const
Returns the current map settings used for the current legend filter (or null if none is enabled) ...
virtual bool removeRows(int row, int count, const QModelIndex &parent)
void setAutoCollapseLegendNodes(int nodeCount)
Set at what number of legend nodes the layer node should be collapsed. Setting -1 disables the auto-c...
int mAutoCollapseLegendNodesCount
Minimal number of nodes when legend should be automatically collapsed. -1 = disabled.
double legendFilterByScale() const
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.
Structure that stores all data associated with one map layer.