16 #ifndef QGSLAYERTREEMODEL_H
17 #define QGSLAYERTREEMODEL_H
19 #include <QAbstractItemModel>
57 int rowCount(
const QModelIndex &parent = QModelIndex() )
const;
58 int columnCount(
const QModelIndex &parent = QModelIndex() )
const;
59 QModelIndex
index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const;
60 QModelIndex parent(
const QModelIndex &child )
const;
61 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const;
62 Qt::ItemFlags flags(
const QModelIndex &index )
const;
63 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole );
64 Qt::DropActions supportedDropActions()
const;
65 QStringList mimeTypes()
const;
66 QMimeData* mimeData(
const QModelIndexList& indexes )
const;
67 bool dropMimeData(
const QMimeData* data, Qt::DropAction action,
int row,
int column,
const QModelIndex& parent );
68 bool removeRows(
int row,
int count,
const QModelIndex& parent = QModelIndex() );
76 ShowSymbology = 0x0001,
77 ShowRasterPreviewIcon = 0x0002,
80 AllowNodeReorder = 0x1000,
81 AllowNodeRename = 0x2000,
82 AllowNodeChangeVisibility = 0x4000,
83 AllowLegendChangeState = 0x8000,
84 AllowSymbologyChangeState = 0x8000,
86 Q_DECLARE_FLAGS( Flags, Flag )
89 void setFlags( Flags f );
91 void setFlag( Flag f,
bool on = true );
95 bool testFlag( Flag f ) const;
105 QList<
QgsLayerTreeNode*> indexes2nodes( const QModelIndexList& list,
bool skipInternal = false ) const;
130 QModelIndex currentIndex() const;
132 void setCurrentIndex( const QModelIndex& currentIndex );
135 void setLayerTreeNodeFont(
int nodeType, const QFont& font );
137 QFont layerTreeNodeFont(
int nodeType ) const;
140 void setAutoCollapseLegendNodes(
int nodeCount ) { mAutoCollapseLegendNodesCount = nodeCount; }
147 void setLegendFilterByScale(
double scaleDenominator );
160 void setLegendMapViewData(
double mapUnitsPerPixel,
int dpi,
double scale );
164 void legendMapViewData(
double *mapUnitsPerPixel,
int *dpi,
double *scale );
168 Q_DECL_DEPRECATED
bool isIndexSymbologyNode(
const QModelIndex& index )
const;
171 Q_DECL_DEPRECATED
QgsLayerTreeLayer* layerNodeForSymbologyNode(
const QModelIndex& index )
const;
182 void nodeWillAddChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
183 void nodeAddedChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
184 void nodeWillRemoveChildren(
QgsLayerTreeNode* node,
int indexFrom,
int indexTo );
185 void nodeRemovedChildren();
189 void nodeCustomPropertyChanged(
QgsLayerTreeNode* node,
const QString& key );
191 void nodeLayerLoaded();
192 void nodeLayerWillBeUnloaded();
193 void layerLegendChanged();
195 void layerNeedsUpdate();
197 void legendNodeDataChanged();
208 void connectToRootNode();
209 void disconnectFromRootNode();
212 void recursivelyEmitDataChanged(
const QModelIndex& index = QModelIndex() );
214 static const QIcon& iconGroup();
217 QList<QgsLayerTreeModelLegendNode*> filterLegendNodes(
const QList<QgsLayerTreeModelLegendNode*>& nodes );
226 QMap<QgsLayerTreeLayer*, QList<QgsLayerTreeModelLegendNode*> >
mLegendNodes;
249 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayerTreeModel::Flags )
251 #endif // QGSLAYERTREEMODEL_H