QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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 dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ) override;
60 QMimeData *mimeData( const QModelIndexList &indexes ) const override;
61
62 private:
63
64#ifdef SIP_RUN
66#endif
67};
68
77class GUI_EXPORT QgsElevationProfileLayerTreeProxyModel : public QSortFilterProxyModel
78{
79
80 Q_OBJECT
81
82 public:
83
87 explicit QgsElevationProfileLayerTreeProxyModel( QgsElevationProfileLayerTreeModel *model, QObject *parent = nullptr );
88
89 protected:
90
91 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
92
93 private:
94
95 QgsElevationProfileLayerTreeModel *mModel = nullptr;
96
97};
98
107class GUI_EXPORT QgsElevationProfileLayerTreeView : public QTreeView
108{
109
110 Q_OBJECT
111
112 public:
113
118 explicit QgsElevationProfileLayerTreeView( QgsLayerTree *rootNode, QWidget *parent = nullptr );
119
123 QgsMapLayer *indexToLayer( const QModelIndex &index );
124
128 void populateInitialLayers( QgsProject *project );
129
130 protected:
131
132 void resizeEvent( QResizeEvent *event ) override;
133
134 private:
135
136 QgsElevationProfileLayerTreeModel *mModel = nullptr;
137 QgsElevationProfileLayerTreeProxyModel *mProxyModel = nullptr;
138 QgsLayerTree *mLayerTree = nullptr;
139
140};
141
142
143#endif // QGSELEVATIONPROFILELAYERTREEVIEW_H
A layer tree model subclass for elevation profiles.
A layer tree view for elevation profiles.
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
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.
Definition: qgslayertree.h:33
Base class for all map layer types.
Definition: qgsmaplayer.h:73
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:105