QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
50 QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
51
52 ~QgsProcessingMapLayerComboBox() override;
53
58 void setLayer( QgsMapLayer *layer );
59
69 QgsMapLayer *currentLayer();
70
79 QString currentText();
80
86 void setValue( const QVariant &value, QgsProcessingContext &context );
87
93 QVariant value() const;
94
99 void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
100
107 void setEditable( bool editable );
108
115 bool isEditable() const;
116
117 signals:
118
122 void valueChanged();
123
124 protected:
125 void dragEnterEvent( QDragEnterEvent *event ) override;
126 void dragLeaveEvent( QDragLeaveEvent *event ) override;
127 void dropEvent( QDropEvent *event ) override;
128
129 private slots:
130
131 void onLayerChanged( QgsMapLayer *layer );
132 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
133 void showSourceOptions();
134 void selectFromFile();
135 void browseForLayer();
136
137 private:
138 std::unique_ptr<QgsProcessingParameterDefinition> mParameter;
139 QgsMapLayerComboBox *mCombo = nullptr;
140 QToolButton *mSelectButton = nullptr;
141 QToolButton *mIterateButton = nullptr;
142 QToolButton *mSettingsButton = nullptr;
143 QCheckBox *mUseSelectionCheckBox = nullptr;
144 bool mDragActive = false;
145 long long mFeatureLimit = -1;
146 QString mFilterExpression;
147 bool mIsOverridingDefaultGeometryCheck = false;
149 QPointer<QgsMapLayer> mPrevLayer;
150 int mBlockChangedSignal = 0;
151
152 QgsBrowserGuiModel *mBrowserModel = nullptr;
153
154 QMenu *mFeatureSourceMenu = nullptr;
155 QgsMapLayer *compatibleMapLayerFromMimeData( const QMimeData *data, bool &incompatibleLayerSelected ) const;
156 QString compatibleUriFromMimeData( const QMimeData *data ) const;
157};
158
160#endif // QGSPROCESSINGMAPLAYERCOMBOBOX_H
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
Definition qgis.h:2135
@ 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