QGIS API Documentation 3.39.0-Master (73c886ac97c)
Loading...
Searching...
No Matches
qgselevationprofilelayertreeview.h
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationprofilelayertreeview.h
3 ---------------
4 begin : April 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSELEVATIONPROFILELAYERTREEVIEW_H
19#define QGSELEVATIONPROFILELAYERTREEVIEW_H
20
21#include "qgsconfig.h"
22#include "qgslayertreemodel.h"
23#include "qgis_gui.h"
24
25#include <QSortFilterProxyModel>
26#include <QTreeView>
27
28#define SIP_NO_FILE
29
30
31class QgsLayerTree;
34class QgsMapLayer;
35
36
46{
47
48 Q_OBJECT
49
50 public:
51
56 explicit QgsElevationProfileLayerTreeModel( QgsLayerTree *rootNode, QObject *parent = nullptr );
57
58 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
59 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
60
61 bool canDropMimeData( const QMimeData *data, Qt::DropAction action,
62 int row, int column, const QModelIndex &parent ) const override;
63 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
64 QMimeData *mimeData( const QModelIndexList &indexes ) const override;
65
66 signals:
67
73 void addLayers( const QList< QgsMapLayer * > &layers );
74
75 private:
76
77#ifdef SIP_RUN
79#endif
80};
81
90class GUI_EXPORT QgsElevationProfileLayerTreeProxyModel : public QSortFilterProxyModel
91{
92
93 Q_OBJECT
94
95 public:
96
100 explicit QgsElevationProfileLayerTreeProxyModel( QgsElevationProfileLayerTreeModel *model, QObject *parent = nullptr );
101
102 protected:
103
104 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
105
106 private:
107
108 QgsElevationProfileLayerTreeModel *mModel = nullptr;
109
110};
111
120class GUI_EXPORT QgsElevationProfileLayerTreeView : public QTreeView
121{
122
123 Q_OBJECT
124
125 public:
126
131 explicit QgsElevationProfileLayerTreeView( QgsLayerTree *rootNode, QWidget *parent = nullptr );
132
136 QgsMapLayer *indexToLayer( const QModelIndex &index );
137
141 void populateInitialLayers( QgsProject *project );
142
149
150 signals:
151
157 void addLayers( const QList< QgsMapLayer * > &layers );
158
159 protected:
160
161 void resizeEvent( QResizeEvent *event ) override;
162
163 private:
164
165 QgsElevationProfileLayerTreeModel *mModel = nullptr;
166 QgsElevationProfileLayerTreeProxyModel *mProxyModel = nullptr;
167 QgsLayerTree *mLayerTree = nullptr;
168
169};
170
171
172#endif // QGSELEVATIONPROFILELAYERTREEVIEW_H
A layer tree model subclass for elevation profiles.
void addLayers(const QList< QgsMapLayer * > &layers)
Emitted when layers should be added to the profile, e.g.
A layer tree view for elevation profiles.
void addLayers(const QList< QgsMapLayer * > &layers)
Emitted when layers should be added to the profile, e.g.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QMimeData * mimeData(const QModelIndexList &indexes) const override
Namespace with helper functions for layer tree operations.
Base class for all map layer types.
Definition qgsmaplayer.h:75
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107