QGIS API Documentation 3.41.0-Master (af5edcb665c)
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 Q_OBJECT
48
49 public:
54 explicit QgsElevationProfileLayerTreeModel( QgsLayerTree *rootNode, QObject *parent = nullptr );
55
56 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
57 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
58
59 bool canDropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) const override;
60 bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
61 QMimeData *mimeData( const QModelIndexList &indexes ) const override;
62
63 signals:
64
70 void addLayers( const QList<QgsMapLayer *> &layers );
71
72 private:
73#ifdef SIP_RUN
75#endif
76};
77
86class GUI_EXPORT QgsElevationProfileLayerTreeProxyModel : public QSortFilterProxyModel
87{
88 Q_OBJECT
89
90 public:
94 explicit QgsElevationProfileLayerTreeProxyModel( QgsElevationProfileLayerTreeModel *model, QObject *parent = nullptr );
95
96 protected:
97 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
98
99 private:
100 QgsElevationProfileLayerTreeModel *mModel = nullptr;
101};
102
111class GUI_EXPORT QgsElevationProfileLayerTreeView : public QTreeView
112{
113 Q_OBJECT
114
115 public:
120 explicit QgsElevationProfileLayerTreeView( QgsLayerTree *rootNode, QWidget *parent = nullptr );
121
125 QgsMapLayer *indexToLayer( const QModelIndex &index );
126
130 void populateInitialLayers( QgsProject *project );
131
138
139 signals:
140
146 void addLayers( const QList<QgsMapLayer *> &layers );
147
148 protected:
149 void resizeEvent( QResizeEvent *event ) override;
150
151 private:
152 QgsElevationProfileLayerTreeModel *mModel = nullptr;
153 QgsElevationProfileLayerTreeProxyModel *mProxyModel = nullptr;
154 QgsLayerTree *mLayerTree = nullptr;
155};
156
157
158#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:76
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107