QGIS API Documentation  2.99.0-Master (19b062c)
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsFilterLineEdit Class Reference

QLineEdit subclass with built in support for clearing the widget's value and handling custom null value representations. More...

#include <qgsfilterlineedit.h>

Inheritance diagram for QgsFilterLineEdit:
Inheritance graph
[legend]

Public Types

enum  ClearMode { ClearToNull = 0, ClearToDefault }
 Behavior when clearing value of widget. More...
 

Public Slots

virtual void clearValue ()
 Clears the widget and resets it to the null value. More...
 

Signals

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

 QgsFilterLineEdit (QWidget *parent=0, 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 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...
 
 Q_ENUM (ClearMode)
 
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...
 

Protected Member Functions

void focusInEvent (QFocusEvent *e) override
 
void leaveEvent (QEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void paintEvent (QPaintEvent *e) override
 

Properties

ClearMode clearMode
 
QString defaultValue
 
QString nullValue
 
bool showClearButton
 
bool showSearchIcon
 
bool showSpinner
 
QString value
 

Detailed Description

QLineEdit subclass with built in support for clearing the widget's value and handling custom null value representations.

When using QgsFilterLineEdit the value(), setValue() and clearValue() methods should be used instead of QLineEdit's text(), setText() and clear() methods, and the valueChanged() signal should be used instead of textChanged().

Definition at line 38 of file qgsfilterlineedit.h.

Member Enumeration Documentation

◆ ClearMode

Behavior when clearing value of widget.

Enumerator
ClearToNull 

Reset value to null.

ClearToDefault 

Reset value to default value (see defaultValue() )

Definition at line 62 of file qgsfilterlineedit.h.

Constructor & Destructor Documentation

◆ QgsFilterLineEdit()

QgsFilterLineEdit::QgsFilterLineEdit ( QWidget *  parent = 0,
const QString &  nullValue = QString() 
)

Constructor for QgsFilterLineEdit.

Parameters
parentparent widget
nullValuestring for representing null values

Definition at line 27 of file qgsfilterlineedit.cpp.

Member Function Documentation

◆ cleared

void QgsFilterLineEdit::cleared ( )
signal

Emitted when the widget is cleared.

See also
clearValue()

◆ clearMode()

ClearMode QgsFilterLineEdit::clearMode ( ) const
inline

Returns the clear mode for the widget.

The clear mode defines the behavior of the widget when its value is cleared. This defaults to ClearToNull.

See also
setClearMode()
Since
QGIS 3.0

Definition at line 97 of file qgsfilterlineedit.h.

◆ clearValue

void QgsFilterLineEdit::clearValue ( )
virtualslot

Clears the widget and resets it to the null value.

See also
nullValue()
Since
QGIS 3.0

Definition at line 121 of file qgsfilterlineedit.cpp.

◆ defaultValue()

QString QgsFilterLineEdit::defaultValue ( ) const
inline

Returns the default value for the widget.

The default value is a value which the widget will be reset to if it is cleared and the clearMode() is equal to ClearToDefault.

See also
setDefaultValue()
clearMode()
Since
QGIS 3.0

Definition at line 157 of file qgsfilterlineedit.h.

◆ focusInEvent()

void QgsFilterLineEdit::focusInEvent ( QFocusEvent *  e)
overrideprotected

Definition at line 111 of file qgsfilterlineedit.cpp.

◆ isNull()

bool QgsFilterLineEdit::isNull ( ) const
inline

Determine if the current text represents null.

Returns
True if the widget's value is null.
See also
nullValue()

Definition at line 184 of file qgsfilterlineedit.h.

◆ leaveEvent()

void QgsFilterLineEdit::leaveEvent ( QEvent *  e)
overrideprotected

Definition at line 173 of file qgsfilterlineedit.cpp.

◆ mouseMoveEvent()

void QgsFilterLineEdit::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 91 of file qgsfilterlineedit.cpp.

◆ mousePressEvent()

void QgsFilterLineEdit::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 78 of file qgsfilterlineedit.cpp.

◆ nullValue()

QString QgsFilterLineEdit::nullValue ( ) const
inline

Returns the string used for representating null values in the widget.

See also
setNullValue()
isNull()

Definition at line 121 of file qgsfilterlineedit.h.

◆ paintEvent()

void QgsFilterLineEdit::paintEvent ( QPaintEvent *  e)
overrideprotected

Definition at line 145 of file qgsfilterlineedit.cpp.

◆ Q_ENUM()

QgsFilterLineEdit::Q_ENUM ( ClearMode  )

◆ selectOnFocus()

bool QgsFilterLineEdit::selectOnFocus ( ) const

Will select all text when this widget receives the focus.

Since
QGIS 3.0

Definition at line 209 of file qgsfilterlineedit.cpp.

◆ selectOnFocusChanged

void QgsFilterLineEdit::selectOnFocusChanged ( )
signal

Will select all text when this widget receives the focus.

Since
QGIS 3.0

◆ setClearMode()

void QgsFilterLineEdit::setClearMode ( ClearMode  mode)
inline

Sets the clear mode for the widget.

The clear mode defines the behavior of the widget when its value is cleared. This defaults to ClearToNull.

See also
clearMode()
Since
QGIS 3.0

Definition at line 105 of file qgsfilterlineedit.h.

◆ setDefaultValue()

void QgsFilterLineEdit::setDefaultValue ( const QString &  defaultValue)
inline

Sets the default value for the widget.

The default value is a value which the widget will be reset to if it is cleared and the clearMode() is equal to ClearToDefault.

Parameters
defaultValuedefault value
See also
defaultValue()
clearMode()
Since
QGIS 3.0

Definition at line 147 of file qgsfilterlineedit.h.

◆ setNullValue()

void QgsFilterLineEdit::setNullValue ( const QString &  nullValue)
inline

Sets the string representation for null values in the widget.

This does not affect the values returned for null values by value(), rather it only affects the text that is shown to users when the widget's value is null.

Parameters
nullValuestring to show when widget's value is null
See also
nullValue()

Definition at line 114 of file qgsfilterlineedit.h.

◆ setSelectOnFocus()

void QgsFilterLineEdit::setSelectOnFocus ( bool  selectOnFocus)

Will select all text when this widget receives the focus.

Since
QGIS 3.0

Definition at line 214 of file qgsfilterlineedit.cpp.

◆ setShowClearButton()

void QgsFilterLineEdit::setShowClearButton ( bool  visible)

Sets whether the widget's clear button is visible.

Parameters
visibleset to false to hide the clear button
See also
showClearButton()
Since
QGIS 3.0

Definition at line 57 of file qgsfilterlineedit.cpp.

◆ setShowSearchIcon()

void QgsFilterLineEdit::setShowSearchIcon ( bool  visible)

Define if a search icon shall be shown on the left of the image when no text is entered.

Parameters
visibleset to false to hide the search icon
Since
QGIS 3.0

Definition at line 68 of file qgsfilterlineedit.cpp.

◆ setShowSpinner()

void QgsFilterLineEdit::setShowSpinner ( bool  showSpinner)

Show a spinner icon.

This can be used for search boxes to indicate that something is going on in the background.

Since
QGIS 3.0

Definition at line 228 of file qgsfilterlineedit.cpp.

◆ setValue()

void QgsFilterLineEdit::setValue ( const QString &  value)
inline

Sets the current text for the widget with support for handling null values.

Parameters
valueThe text to set. If a null string is provided, the text shown in the widget will be set to the current nullValue().
See also
value()

Definition at line 166 of file qgsfilterlineedit.h.

◆ showClearButton()

bool QgsFilterLineEdit::showClearButton ( ) const
inline

Returns true if the widget's clear button is visible.

See also
setShowClearButton()
Since
QGIS 3.0

Definition at line 81 of file qgsfilterlineedit.h.

◆ showSearchIcon()

bool QgsFilterLineEdit::showSearchIcon ( ) const
inline

Returns if a search icon shall be shown on the left of the image when no text is entered.

Since
QGIS 3.0

Definition at line 136 of file qgsfilterlineedit.h.

◆ showSpinner()

bool QgsFilterLineEdit::showSpinner ( ) const

Show a spinner icon.

This can be used for search boxes to indicate that something is going on in the background.

Since
QGIS 3.0

◆ showSpinnerChanged

void QgsFilterLineEdit::showSpinnerChanged ( )
signal

Show a spinner icon.

This can be used for search boxes to indicate that something is going on in the background.

Since
QGIS 3.0

◆ value()

QString QgsFilterLineEdit::value ( ) const
inline

Returns the text of this edit with support for handling null values.

If the text in the widget matches the current nullValue() then the returned value will be a null string.

Returns
Current text (or null string if it matches the nullValue() property )
See also
setValue()

Definition at line 176 of file qgsfilterlineedit.h.

◆ valueChanged

void QgsFilterLineEdit::valueChanged ( const QString &  value)
signal

Same as textChanged() but with support for null values.

Parameters
valueThe current text or null string if it matches the nullValue() property.

Property Documentation

◆ clearMode

ClearMode QgsFilterLineEdit::clearMode
readwrite

Definition at line 51 of file qgsfilterlineedit.h.

◆ defaultValue

QString QgsFilterLineEdit::defaultValue
readwrite

Definition at line 53 of file qgsfilterlineedit.h.

◆ nullValue

QString QgsFilterLineEdit::nullValue
readwrite

Definition at line 52 of file qgsfilterlineedit.h.

◆ showClearButton

bool QgsFilterLineEdit::showClearButton
readwrite

Definition at line 55 of file qgsfilterlineedit.h.

◆ showSearchIcon

bool QgsFilterLineEdit::showSearchIcon
readwrite

Definition at line 56 of file qgsfilterlineedit.h.

◆ showSpinner

bool QgsFilterLineEdit::showSpinner
readwrite

Definition at line 57 of file qgsfilterlineedit.h.

◆ value

QString QgsFilterLineEdit::value
readwrite

Definition at line 54 of file qgsfilterlineedit.h.


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