QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "qgsfeatureid.h"
22#include "qgsmimedatautils.h"
24#include "qgsprocessinggui.h"
25
26#include <QTreeView>
27
29class QToolButton;
30class QCheckBox;
34
36
43class GUI_EXPORT QgsProcessingMapLayerComboBox : public QWidget
44{
45 Q_OBJECT
46
47 public:
51 QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, Qgis::ProcessingMode type = Qgis::ProcessingMode::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 void dragEnterEvent( QDragEnterEvent *event ) override;
127 void dragLeaveEvent( QDragLeaveEvent *event ) override;
128 void dropEvent( QDropEvent *event ) override;
129
130 private slots:
131
132 void onLayerChanged( QgsMapLayer *layer );
133 void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
134 void showSourceOptions();
135 void showRasterSourceOptions();
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 double mRasterReferenceScale = 0;
152 int mRasterDpi = 0;
153 QPointer<QgsMapLayer> mPrevLayer;
154 int mBlockChangedSignal = 0;
155
156 QgsBrowserGuiModel *mBrowserModel = nullptr;
157
158 QMenu *mFeatureSourceMenu = nullptr;
159 QgsMapLayer *compatibleMapLayerFromMimeData( const QMimeData *data, bool &incompatibleLayerSelected ) const;
160 QString compatibleUriFromMimeData( const QMimeData *data ) const;
161};
162
164#endif // QGSPROCESSINGMAPLAYERCOMBOBOX_H
ProcessingMode
Types of modes which Processing widgets can be created for.
Definition qgis.h:3671
@ Standard
Standard (single-run) algorithm mode.
Definition qgis.h:3672
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
Definition qgis.h:2238
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
Definition qgis.h:2241
A model for showing available data sources and other items in a structured tree.
A combobox which displays a dynamic list of layers from a QGIS project.
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