2016-12-15 16:46:29 +10:00
|
|
|
/** \class QgsFieldValuesLineEdit
|
|
|
|
* \ingroup gui
|
|
|
|
* A line edit with an autocompleter which takes unique values from a vector layer's fields.
|
|
|
|
* The autocompleter is populated from the vector layer in the background to ensure responsive
|
|
|
|
* interaction with the widget.
|
|
|
|
* \note added in QGIS 3.0
|
|
|
|
*/
|
|
|
|
class QgsFieldValuesLineEdit: QgsFilterLineEdit
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsfieldvalueslineedit.h>
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
/** Constructor for QgsFieldValuesLineEdit
|
|
|
|
* @param parent parent widget
|
|
|
|
*/
|
|
|
|
QgsFieldValuesLineEdit( QWidget *parent /TransferThis/ = nullptr );
|
|
|
|
|
|
|
|
virtual ~QgsFieldValuesLineEdit();
|
|
|
|
|
|
|
|
/** Sets the layer containing the field that values will be shown from.
|
|
|
|
* @param layer vector layer
|
|
|
|
* @see layer()
|
|
|
|
* @see setAttributeIndex()
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void setLayer( QgsVectorLayer *layer );
|
2016-12-15 16:46:29 +10:00
|
|
|
|
|
|
|
/** Returns the layer containing the field that values will be shown from.
|
|
|
|
* @see setLayer()
|
|
|
|
* @see attributeIndex()
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsVectorLayer *layer() const;
|
2016-12-15 16:46:29 +10:00
|
|
|
|
|
|
|
/** Sets the attribute index for the field containing values to show in the widget.
|
|
|
|
* @param index index of attribute
|
|
|
|
* @see attributeIndex()
|
|
|
|
* @see setLayer()
|
|
|
|
*/
|
|
|
|
void setAttributeIndex( int index );
|
|
|
|
|
|
|
|
/** Returns the attribute index for the field containing values shown in the widget.
|
|
|
|
* @see setAttributeIndex()
|
|
|
|
* @see layer()
|
|
|
|
*/
|
|
|
|
int attributeIndex() const;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
/** Emitted when the layer associated with the widget changes.
|
|
|
|
* @param layer vector layer
|
|
|
|
*/
|
2017-05-01 16:42:33 +02:00
|
|
|
void layerChanged( QgsVectorLayer *layer );
|
2016-12-15 16:46:29 +10:00
|
|
|
|
|
|
|
/** Emitted when the field associated with the widget changes.
|
|
|
|
* @param index new attribute index for field
|
|
|
|
*/
|
|
|
|
void attributeIndexChanged( int index );
|
|
|
|
};
|