QGIS API Documentation  3.6.0-Noosa (5873452)
Signals | Public Member Functions | Properties | List of all members
QgsFieldValuesLineEdit Class Reference

A line edit with an autocompleter which takes unique values from a vector layer's fields. More...

#include <qgsfieldvalueslineedit.h>

Inheritance diagram for QgsFieldValuesLineEdit:
Inheritance graph
[legend]

Signals

void attributeIndexChanged (int index)
 Emitted when the field associated with the widget changes. More...
 
void layerChanged (QgsVectorLayer *layer)
 Emitted when the layer associated with the widget changes. More...
 
- Signals inherited from QgsFilterLineEdit
void cleared ()
 Emitted when the widget is cleared. More...
 
void selectOnFocusChanged ()
 Will select all text when this widget receives the focus. More...
 
void showSpinnerChanged ()
 Show a spinner icon. More...
 
void valueChanged (const QString &value)
 Same as textChanged() but with support for null values. More...
 

Public Member Functions

 QgsFieldValuesLineEdit (QWidget *parent=nullptr)
 Constructor for QgsFieldValuesLineEdit. More...
 
 ~QgsFieldValuesLineEdit () override
 
int attributeIndex () const
 Returns the attribute index for the field containing values shown in the widget. More...
 
QgsVectorLayerlayer () const
 Returns the layer containing the field that values will be shown from. More...
 
void setAttributeIndex (int index)
 Sets the attribute index for the field containing values to show in the widget. More...
 
void setLayer (QgsVectorLayer *layer)
 Sets the layer containing the field that values will be shown from. More...
 
- Public Member Functions inherited from QgsFilterLineEdit
 QgsFilterLineEdit (QWidget *parent=nullptr, const QString &nullValue=QString())
 Constructor for QgsFilterLineEdit. More...
 
ClearMode clearMode () const
 Returns the clear mode for the widget. More...
 
QString defaultValue () const
 Returns the default value for the widget. More...
 
bool event (QEvent *event) override
 Reimplemented to enable/disable the clear action depending on read-only status. More...
 
bool isNull () const
 Determine if the current text represents null. More...
 
QString nullValue () const
 Returns the string used for representating null values in the widget. More...
 
bool selectOnFocus () const
 Will select all text when this widget receives the focus. More...
 
void setClearMode (ClearMode mode)
 Sets the clear mode for the widget. More...
 
void setDefaultValue (const QString &defaultValue)
 Sets the default value for the widget. More...
 
void setNullValue (const QString &nullValue)
 Sets the string representation for null values in the widget. More...
 
void setSelectOnFocus (bool selectOnFocus)
 Will select all text when this widget receives the focus. More...
 
void setShowClearButton (bool visible)
 Sets whether the widget's clear button is visible. More...
 
void setShowSearchIcon (bool visible)
 Define if a search icon shall be shown on the left of the image when no text is entered. More...
 
void setShowSpinner (bool showSpinner)
 Show a spinner icon. More...
 
void setValue (const QString &value)
 Sets the current text for the widget with support for handling null values. More...
 
bool showClearButton () const
 Returns true if the widget's clear button is visible. More...
 
bool showSearchIcon () const
 Returns if a search icon shall be shown on the left of the image when no text is entered. More...
 
bool showSpinner () const
 Show a spinner icon. More...
 
QString value () const
 Returns the text of this edit with support for handling null values. More...
 

Properties

int attributeIndex
 
QgsVectorLayer layer
 
- Properties inherited from QgsFilterLineEdit
ClearMode clearMode
 
QString defaultValue
 
QString nullValue
 
bool showClearButton
 
bool showSearchIcon
 
bool showSpinner
 
QString value
 

Additional Inherited Members

- Public Types inherited from QgsFilterLineEdit
enum  ClearMode { ClearToNull = 0, ClearToDefault }
 Behavior when clearing value of widget. More...
 
- Public Slots inherited from QgsFilterLineEdit
virtual void clearValue ()
 Clears the widget and resets it to the null value. More...
 
- Protected Member Functions inherited from QgsFilterLineEdit
void focusInEvent (QFocusEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 

Detailed Description

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.

Since
QGIS 3.0

Definition at line 100 of file qgsfieldvalueslineedit.h.

Constructor & Destructor Documentation

◆ QgsFieldValuesLineEdit()

QgsFieldValuesLineEdit::QgsFieldValuesLineEdit ( QWidget *  parent = nullptr)

Constructor for QgsFieldValuesLineEdit.

Parameters
parentparent widget

Definition at line 25 of file qgsfieldvalueslineedit.cpp.

◆ ~QgsFieldValuesLineEdit()

QgsFieldValuesLineEdit::~QgsFieldValuesLineEdit ( )
override

Definition at line 38 of file qgsfieldvalueslineedit.cpp.

Member Function Documentation

◆ attributeIndex()

int QgsFieldValuesLineEdit::attributeIndex ( ) const
inline

Returns the attribute index for the field containing values shown in the widget.

See also
setAttributeIndex()
layer()

Definition at line 145 of file qgsfieldvalueslineedit.h.

◆ attributeIndexChanged

void QgsFieldValuesLineEdit::attributeIndexChanged ( int  index)
signal

Emitted when the field associated with the widget changes.

Parameters
indexnew attribute index for field

◆ layer()

QgsVectorLayer* QgsFieldValuesLineEdit::layer ( ) const
inline

Returns the layer containing the field that values will be shown from.

See also
setLayer()
attributeIndex()

Definition at line 130 of file qgsfieldvalueslineedit.h.

◆ layerChanged

void QgsFieldValuesLineEdit::layerChanged ( QgsVectorLayer layer)
signal

Emitted when the layer associated with the widget changes.

Parameters
layervector layer

◆ setAttributeIndex()

void QgsFieldValuesLineEdit::setAttributeIndex ( int  index)

Sets the attribute index for the field containing values to show in the widget.

Parameters
indexindex of attribute
See also
attributeIndex()
setLayer()

Definition at line 56 of file qgsfieldvalueslineedit.cpp.

◆ setLayer()

void QgsFieldValuesLineEdit::setLayer ( QgsVectorLayer layer)

Sets the layer containing the field that values will be shown from.

Parameters
layervector layer
See also
layer()
setAttributeIndex()

Definition at line 47 of file qgsfieldvalueslineedit.cpp.

Property Documentation

◆ attributeIndex

int QgsFieldValuesLineEdit::attributeIndex
readwrite

Definition at line 105 of file qgsfieldvalueslineedit.h.

◆ layer

QgsVectorLayer QgsFieldValuesLineEdit::layer
readwrite

Definition at line 104 of file qgsfieldvalueslineedit.h.


The documentation for this class was generated from the following files: