15#ifndef QGSFIELDVALUESLINEEDIT_H
16#define QGSFIELDVALUESLINEEDIT_H
22#include <QStringListModel>
45class QgsFieldValuesLineEditValuesGatherer:
public QThread
50 QgsFieldValuesLineEditValuesGatherer(
QgsVectorLayer *layer,
int attributeIndex )
52 , mAttributeIndex( attributeIndex )
53 , mWasCanceled( false )
59 void setSubstring(
const QString &
string ) { mSubstring = string; }
67 bool wasCanceled()
const {
return mWasCanceled; }
75 void collectedValues(
const QStringList &values );
84 QMutex mFeedbackMutex;
104 Q_PROPERTY(
QgsVectorLayer *layer READ layer WRITE setLayer NOTIFY layerChanged )
105 Q_PROPERTY(
int attributeIndex READ attributeIndex WRITE setAttributeIndex NOTIFY attributeIndexChanged )
138 void setAttributeIndex(
int index );
167 void requestCompleterUpdate();
173 void triggerCompleterUpdate();
179 void updateCompleter(
const QStringList &values );
186 void gathererThreadFinished();
191 int mAttributeIndex = -1;
194 bool mUpdateRequested =
false;
197 QTimer mShowPopupTimer;
200 QgsFieldValuesLineEditValuesGatherer *mGatherer =
nullptr;
203 QString mRequestedCompletionText;
206 void updateCompletionList(
const QString &substring );
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A line edit with an autocompleter which takes unique values from a vector layer's fields.
void attributeIndexChanged(int index)
Emitted when the field associated with the widget changes.
void layerChanged(QgsVectorLayer *layer)
Emitted when the layer associated with the widget changes.
int attributeIndex() const
Returns the attribute index for the field containing values shown in the widget.
QgsVectorLayer * layer() const
Returns the layer containing the field that values will be shown from.
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 data sets.