15 #ifndef QGSFIELDVALUESLINEEDIT_H 16 #define QGSFIELDVALUESLINEEDIT_H 22 #include <QStringListModel> 24 #include <QFocusEvent> 25 #include <QHeaderView> 42 class QgsFieldValuesLineEditValuesGatherer:
public QThread
47 QgsFieldValuesLineEditValuesGatherer(
QgsVectorLayer *layer,
int attributeIndex )
49 , mAttributeIndex( attributeIndex )
50 , mWasCanceled( false )
56 void setSubstring(
const QString &
string ) { mSubstring = string; }
61 if ( mSubstring.isEmpty() )
63 emit collectedValues( QStringList() );
70 mValues = mLayer->uniqueStringsMatching( mAttributeIndex, mSubstring, 100, mFeedback );
73 mFeedbackMutex.lock();
76 mFeedbackMutex.unlock();
78 emit collectedValues( mValues );
85 mFeedbackMutex.lock();
88 mFeedbackMutex.unlock();
94 bool wasCanceled()
const {
return mWasCanceled; }
102 void collectedValues(
const QStringList &values );
111 QMutex mFeedbackMutex;
131 Q_PROPERTY(
QgsVectorLayer *layer READ layer WRITE setLayer NOTIFY layerChanged )
132 Q_PROPERTY(
int attributeIndex READ attributeIndex WRITE setAttributeIndex NOTIFY attributeIndexChanged )
165 void setAttributeIndex(
int index );
186 void attributeIndexChanged(
int index );
194 void requestCompleterUpdate();
200 void triggerCompleterUpdate();
206 void updateCompleter(
const QStringList &values );
213 void gathererThreadFinished();
218 int mAttributeIndex = -1;
221 bool mUpdateRequested =
false;
224 QTimer mShowPopupTimer;
227 QgsFieldValuesLineEditValuesGatherer *mGatherer =
nullptr;
230 QString mRequestedCompletionText;
233 void updateCompletionList(
const QString &substring );
238 #endif //QGSFIELDVALUESLINEEDIT_H
int attributeIndex() const
Returns the attribute index for the field containing values shown in the widget.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
A line edit with an autocompleter which takes unique values from a vector layer's fields...
Represents a vector layer which manages a vector based data sets.