QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsfeaturelistcombobox.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturelistcombobox.h - QgsFeatureListComboBox
3 ---------------------
4 begin : 10.3.2017
5 copyright : (C) 2017 by Matthias Kuhn
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#ifndef QGSFIELDLISTCOMBOBOX_H
16#define QGSFIELDLISTCOMBOBOX_H
17
18#include "qgis_gui.h"
19#include "qgsfeature.h"
20
21#include <QComboBox>
22
23class QgsVectorLayer;
25class QgsAnimatedIcon;
28
37class GUI_EXPORT QgsFeatureListComboBox : public QComboBox
38{
39 Q_OBJECT
40
47 Q_PROPERTY( bool allowNull READ allowNull WRITE setAllowNull NOTIFY allowNullChanged )
48
49 public:
50
54 QgsFeatureListComboBox( QWidget *parent = nullptr );
55
60
65
70 void setCurrentFeature( const QgsFeature &feature );
71
76 QString displayExpression() const;
77
82 void setDisplayExpression( const QString &displayExpression );
83
90 int nullIndex() const;
91
96 QString filterExpression() const;
97
102 void setFilterExpression( const QString &filterExpression );
103
108 QgsFeature formFeature() const;
109
114 void setFormFeature( const QgsFeature &feature );
115
121
126 void setParentFormFeature( const QgsFeature &feature );
127
133 Q_DECL_DEPRECATED QVariant identifierValue() const SIP_DEPRECATED;
134
140 QVariantList identifierValues() const;
141
142
148 Q_DECL_DEPRECATED void setIdentifierValue( const QVariant &identifierValue ) SIP_DEPRECATED;
149
155 void setIdentifierValues( const QVariantList &identifierValues );
156
162
168
172 bool allowNull() const;
173
177 void setAllowNull( bool allowNull );
178
183 int fetchLimit() const;
184
190 void setFetchLimit( int fetchLimit );
191
197 Q_DECL_DEPRECATED QString identifierField() const SIP_DEPRECATED;
198
204 QStringList identifierFields() const;
205
211 Q_DECL_DEPRECATED void setIdentifierField( const QString &identifierField ) SIP_DEPRECATED;
212
218 void setIdentifierFields( const QStringList &identifierFields );
219
223 QModelIndex currentModelIndex() const;
224
225 void focusOutEvent( QFocusEvent *event ) override;
226
227 void keyPressEvent( QKeyEvent *event ) override;
228
233 QString orderExpression() const;
234
239 void setOrderExpression( const QString &orderExpression );
240
245 Qt::SortOrder sortOrder() const;
246
251 void setSortOrder( const Qt::SortOrder sortOrder );
252
253 signals:
254
261
266
272
278
284
290
296
302
307
313
318 void currentFeatureFoundChanged( bool found );
319
320 private slots:
321 void onCurrentTextChanged( const QString &text );
322 void onFilterLineEditCleared();
323 void onFilterUpdateCompleted();
324 void onLoadingChanged();
325 void onItemSelected( const QModelIndex &index );
326 void onCurrentIndexChanged( int i );
327 void onActivated( QModelIndex index );
328 void storeLineEditState();
329 void restoreLineEditState();
330 void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>() );
331
332 private:
333 QgsFeatureFilterModel *mModel = nullptr;
334 QCompleter *mCompleter = nullptr;
335 QgsFilterLineEdit *mLineEdit;
336 bool mPopupRequested = false;
337 bool mIsCurrentlyEdited = false;
338
340};
341
342
343#endif // QGSFIELDLISTCOMBOBOX_H
Animated icon is keeping an animation running if there are listeners connected to frameChanged.
Provides a list of features based on filter conditions.
void setIdentifierValues(const QVariantList &identifierValues)
The identifier values of the currently selected feature.
void keyPressEvent(QKeyEvent *event) override
Q_DECL_DEPRECATED void setIdentifierField(const QString &identifierField)
Field name that will be used to uniquely identify the current feature.
void setDisplayExpression(const QString &displayExpression)
The display expression will be used to display features as well as the value to match the typed text ...
QModelIndex currentModelIndex() const
The index of the currently selected item.
void setFilterExpression(const QString &filterExpression)
An additional expression to further restrict the available features.
void setSortOrder(const Qt::SortOrder sortOrder)
The order direction of the model.
void setIdentifierFields(const QStringList &identifierFields)
Field name that will be used to uniquely identify the current feature.
void allowNullChanged()
Determines if a NULL value should be available in the list.
QgsFeature parentFormFeature() const
Returns a parent attribute form feature to be used with the filter expression.
QgsFeatureListComboBox(QWidget *parent=nullptr)
Create a new QgsFeatureListComboBox, optionally specifying a parent.
void focusOutEvent(QFocusEvent *event) override
void setSourceLayer(QgsVectorLayer *sourceLayer)
The layer from which features should be listed.
void setParentFormFeature(const QgsFeature &feature)
Sets a parent attribute form feature to be used with the filter expression.
void modelUpdated()
The underlying model has been updated.
QgsFeature formFeature() const
Returns an attribute form feature to be used with the filter expression.
QgsFeatureRequest currentFeatureRequest() const
Shorthand for getting a feature request to query the currently selected feature.
void setIdentifierValuesToNull()
Sets the identifier values of the currently selected feature to NULL value(s).
void formFeatureChanged()
An attribute form feature to be used alongside the filter expression.
void identifierValueChanged()
The identifier value of the currently selected feature.
Qt::SortOrder sortOrder() const
The order direction of the model.
void setOrderExpression(const QString &orderExpression)
The order expression of the model.
QString orderExpression() const
The order expression of the model.
void sourceLayerChanged()
The layer from which features should be listed.
void setFormFeature(const QgsFeature &feature)
Sets an attribute form feature to be used with the filter expression.
void setCurrentFeature(const QgsFeature &feature)
Sets the current index by using the given feature.
int nullIndex() const
Returns the current index of the NULL value, or -1 if NULL values are not allowed.
void currentFeatureFoundChanged(bool found)
Emitted when the feature picker model changes its feature found state.
int fetchLimit() const
Returns the feature request fetch limit.
Q_DECL_DEPRECATED void setIdentifierValue(const QVariant &identifierValue)
The identifier value of the currently selected feature.
void currentFeatureChanged()
Emitted when the current feature changes.
QStringList identifierFields() const
Field name that will be used to uniquely identify the current feature.
void parentFormFeatureChanged()
A parent attribute form feature to be used alongside the filter expression.
void setAllowNull(bool allowNull)
Determines if a NULL value should be available in the list.
void displayExpressionChanged()
The display expression will be used to display features as well as the the value to match the typed t...
void identifierFieldChanged()
Field name that will be used to uniquely identify the current feature.
void setFetchLimit(int fetchLimit)
Defines the feature request fetch limit If set to 0, no limit is applied when fetching.
void filterExpressionChanged()
An additional expression to further restrict the available features.
Wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
Represents a vector layer which manages a vector based dataset.
#define SIP_DEPRECATED
Definition qgis_sip.h:114