QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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:
53 QgsFeatureListComboBox( QWidget *parent = nullptr );
54
59
64
69 void setCurrentFeature( const QgsFeature &feature );
70
75 QString displayExpression() const;
76
81 void setDisplayExpression( const QString &displayExpression );
82
89 int nullIndex() const;
90
95 QString filterExpression() const;
96
101 void setFilterExpression( const QString &filterExpression );
102
107 QgsFeature formFeature() const;
108
113 void setFormFeature( const QgsFeature &feature );
114
120
125 void setParentFormFeature( const QgsFeature &feature );
126
132 Q_DECL_DEPRECATED QVariant identifierValue() const SIP_DEPRECATED;
133
139 QVariantList identifierValues() const;
140
141
147 Q_DECL_DEPRECATED void setIdentifierValue( const QVariant &identifierValue ) SIP_DEPRECATED;
148
154 void setIdentifierValues( const QVariantList &identifierValues );
155
161
167
171 bool allowNull() const;
172
176 void setAllowNull( bool allowNull );
177
182 int fetchLimit() const;
183
189 void setFetchLimit( int fetchLimit );
190
196 Q_DECL_DEPRECATED QString identifierField() const SIP_DEPRECATED;
197
203 QStringList identifierFields() const;
204
210 Q_DECL_DEPRECATED void setIdentifierField( const QString &identifierField ) SIP_DEPRECATED;
211
217 void setIdentifierFields( const QStringList &identifierFields );
218
222 QModelIndex currentModelIndex() const;
223
224 void focusOutEvent( QFocusEvent *event ) override;
225
226 void keyPressEvent( QKeyEvent *event ) override;
227
232 QString orderExpression() const;
233
238 void setOrderExpression( const QString &orderExpression );
239
244 Qt::SortOrder sortOrder() const;
245
250 void setSortOrder( const Qt::SortOrder sortOrder );
251
252 signals:
253
260
265
271
277
283
289
295
301
306
312
317 void currentFeatureFoundChanged( bool found );
318
319 private slots:
320 void onCurrentTextChanged( const QString &text );
321 void onFilterLineEditCleared();
322 void onFilterUpdateCompleted();
323 void onLoadingChanged();
324 void onItemSelected( const QModelIndex &index );
325 void onCurrentIndexChanged( int i );
326 void onActivated( QModelIndex index );
327 void storeLineEditState();
328 void restoreLineEditState();
329 void onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>() );
330
331 private:
332 QgsFeatureFilterModel *mModel = nullptr;
333 QCompleter *mCompleter = nullptr;
334 QgsFilterLineEdit *mLineEdit;
335 bool mPopupRequested = false;
336 bool mIsCurrentlyEdited = false;
337
339};
340
341
342#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