QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsprocessingmaplayercombobox.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmaplayercombobox.h
3 -----------------------------
4 begin : June 2019
5 copyright : (C) 2019 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSPROCESSINGMAPLAYERCOMBOBOX_H
17#define QGSPROCESSINGMAPLAYERCOMBOBOX_H
18
19#include "qgis.h"
20#include "qgis_gui.h"
21#include <QTreeView>
22#include "qgsfeatureid.h"
23#include "qgsmimedatautils.h"
25#include "qgsprocessinggui.h"
26
28class QToolButton;
29class QCheckBox;
33
35
42class GUI_EXPORT QgsProcessingMapLayerComboBox : public QWidget
43{
44 Q_OBJECT
45
46 public:
47
51 QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
52
53 ~QgsProcessingMapLayerComboBox() override;
54
59 void setLayer( QgsMapLayer *layer );
60
70 QgsMapLayer *currentLayer();
71
80 QString currentText();
81
87 void setValue( const QVariant &value, QgsProcessingContext &context );
88
94 QVariant value() const;
95
100 void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
101
108 void setEditable( bool editable );
109
116 bool isEditable() const;
117
118 signals:
119
123 void valueChanged();
124
125 protected:
126
127 void dragEnterEvent( QDragEnterEvent *event ) override;
128 void dragLeaveEvent( QDragLeaveEvent *event ) override;
129 void dropEvent( QDropEvent *event ) override;
130
131 private slots:
132
133 void onLayerChanged( QgsMapLayer *layer );
134 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
135 void showSourceOptions();
136 void selectFromFile();
137 void browseForLayer();
138
139 private:
140 std::unique_ptr< QgsProcessingParameterDefinition > mParameter;
141 QgsMapLayerComboBox *mCombo = nullptr;
142 QToolButton *mSelectButton = nullptr;
143 QToolButton *mIterateButton = nullptr;
144 QToolButton *mSettingsButton = nullptr;
145 QCheckBox *mUseSelectionCheckBox = nullptr;
146 bool mDragActive = false;
147 long long mFeatureLimit = -1;
148 QString mFilterExpression;
149 bool mIsOverridingDefaultGeometryCheck = false;
151 QPointer< QgsMapLayer> mPrevLayer;
152 int mBlockChangedSignal = 0;
153
154 QgsBrowserGuiModel *mBrowserModel = nullptr;
155
156 QMenu *mFeatureSourceMenu = nullptr;
157 QgsMapLayer *compatibleMapLayerFromMimeData( const QMimeData *data, bool &incompatibleLayerSelected ) const;
158 QString compatibleUriFromMimeData( const QMimeData *data ) const;
159};
160
162#endif // QGSPROCESSINGMAPLAYERCOMBOBOX_H
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
Definition qgis.h:2072
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
A model for showing available data sources and other items in a structured tree.
The QgsMapLayerComboBox class is a combo box which displays the list of layers.
Base class for all map layer types.
Definition qgsmaplayer.h:76
Contains information about the context in which a processing algorithm is executed.
WidgetType
Types of dialogs which Processing widgets can be created for.
@ Standard
Standard algorithm dialog.
Base class for the definition of processing parameters.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
QSet< QgsFeatureId > QgsFeatureIds