QLineEdit subclass with built in support for clearing the widget's value and handling custom null value representations.
More...
#include <qgsfilterlineedit.h>
|
virtual void | clearValue () |
| Clears the widget and resets it to the null value.
|
|
void | restoreState () |
| Restores the current state of the line edit (selection and cursor position)
|
|
void | storeState () |
| Stores the current state of the line edit (selection and cursor position)
|
|
|
| QgsFilterLineEdit (QWidget *parent=nullptr, const QString &nullValue=QString()) |
| Constructor for QgsFilterLineEdit.
|
|
ClearMode | clearMode () const |
| Returns the clear mode for the widget.
|
|
QString | defaultValue () const |
| Returns the default value for the widget.
|
|
bool | event (QEvent *event) override |
| Reimplemented to enable/disable the clear action depending on read-only status.
|
|
bool | hasStateStored () const |
| Returns if a state is already saved.
|
|
bool | isNull () const |
| Determine if the current text represents null.
|
|
QString | nullValue () const |
| Returns the string used for representing null values in the widget.
|
|
bool | selectOnFocus () const |
| Will select all text when this widget receives the focus.
|
|
void | setClearMode (ClearMode mode) |
| Sets the clear mode for the widget.
|
|
void | setDefaultValue (const QString &defaultValue) |
| Sets the default value for the widget.
|
|
void | setNullValue (const QString &nullValue) |
| Sets the string representation for null values in the widget.
|
|
void | setSelectOnFocus (bool selectOnFocus) |
| Will select all text when this widget receives the focus.
|
|
void | setShowClearButton (bool visible) |
| Sets whether the widget's clear button is visible.
|
|
void | setShowSearchIcon (bool visible) |
| Define if a search icon shall be shown on the left of the image when no text is entered.
|
|
void | setShowSpinner (bool showSpinner) |
| Show a spinner icon.
|
|
void | setValue (const QString &value) |
| Sets the current text for the widget with support for handling null values.
|
|
bool | showClearButton () const |
| Returns true if the widget's clear button is visible.
|
|
bool | showSearchIcon () const |
| Returns if a search icon shall be shown on the left of the image when no text is entered.
|
|
bool | showSpinner () const |
| Show a spinner icon.
|
|
QString | value () const |
| Returns the text of this edit with support for handling null values.
|
|
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 39 of file qgsfilterlineedit.h.
◆ ClearMode
Behavior when clearing value of widget.
Enumerator |
---|
ClearToNull | Reset value to null.
|
ClearToDefault | Reset value to default value (see defaultValue() )
|
Definition at line 63 of file qgsfilterlineedit.h.
◆ QgsFilterLineEdit()
QgsFilterLineEdit::QgsFilterLineEdit |
( |
QWidget * |
parent = nullptr , |
|
|
const QString & |
nullValue = QString() |
|
) |
| |
◆ cleared
void QgsFilterLineEdit::cleared |
( |
| ) |
|
|
signal |
◆ 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 98 of file qgsfilterlineedit.h.
◆ clearValue
void QgsFilterLineEdit::clearValue |
( |
| ) |
|
|
virtualslot |
◆ defaultValue()
QString QgsFilterLineEdit::defaultValue |
( |
| ) |
const |
|
inline |
◆ event()
bool QgsFilterLineEdit::event |
( |
QEvent * |
event | ) |
|
|
override |
Reimplemented to enable/disable the clear action depending on read-only status.
- Since
- QGIS 3.0.1
Definition at line 218 of file qgsfilterlineedit.cpp.
◆ focusInEvent()
void QgsFilterLineEdit::focusInEvent |
( |
QFocusEvent * |
e | ) |
|
|
overrideprotected |
◆ hasStateStored()
bool QgsFilterLineEdit::hasStateStored |
( |
| ) |
const |
|
inline |
◆ isNull()
bool QgsFilterLineEdit::isNull |
( |
| ) |
const |
|
inline |
◆ mouseReleaseEvent()
void QgsFilterLineEdit::mouseReleaseEvent |
( |
QMouseEvent * |
e | ) |
|
|
overrideprotected |
◆ nullValue()
QString QgsFilterLineEdit::nullValue |
( |
| ) |
const |
|
inline |
◆ restoreState
void QgsFilterLineEdit::restoreState |
( |
| ) |
|
|
slot |
Restores the current state of the line edit (selection and cursor position)
- Since
- QGIS 3.14
Definition at line 235 of file qgsfilterlineedit.cpp.
◆ selectOnFocus()
bool QgsFilterLineEdit::selectOnFocus |
( |
| ) |
const |
Will select all text when this widget receives the focus.
- Since
- QGIS 3.0
Definition at line 159 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 106 of file qgsfilterlineedit.h.
◆ setDefaultValue()
void QgsFilterLineEdit::setDefaultValue |
( |
const QString & |
defaultValue | ) |
|
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
-
defaultValue | default value |
- See also
- defaultValue()
-
clearMode()
- Since
- QGIS 3.0
Definition at line 65 of file qgsfilterlineedit.cpp.
◆ 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
-
nullValue | string to show when widget's value is null |
- See also
- nullValue()
Definition at line 115 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 164 of file qgsfilterlineedit.cpp.
◆ setShowClearButton()
void QgsFilterLineEdit::setShowClearButton |
( |
bool |
visible | ) |
|
◆ 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
-
visible | set to false to hide the search icon |
- Since
- QGIS 3.0
Definition at line 49 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 178 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
-
value | The 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 167 of file qgsfilterlineedit.h.
◆ showClearButton()
bool QgsFilterLineEdit::showClearButton |
( |
| ) |
const |
|
inline |
◆ 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 137 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
Definition at line 173 of file qgsfilterlineedit.cpp.
◆ 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
◆ storeState
void QgsFilterLineEdit::storeState |
( |
| ) |
|
|
slot |
Stores the current state of the line edit (selection and cursor position)
- Since
- QGIS 3.14
Definition at line 226 of file qgsfilterlineedit.cpp.
◆ 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 177 of file qgsfilterlineedit.h.
◆ valueChanged
void QgsFilterLineEdit::valueChanged |
( |
const QString & |
value | ) |
|
|
signal |
Same as textChanged() but with support for null values.
- Parameters
-
value | The current text or null string if it matches the nullValue() property. |
◆ TestQgsFeatureListComboBox
friend class TestQgsFeatureListComboBox |
|
friend |
◆ clearMode
◆ defaultValue
QString QgsFilterLineEdit::defaultValue |
|
readwrite |
◆ nullValue
QString QgsFilterLineEdit::nullValue |
|
readwrite |
◆ showClearButton
bool QgsFilterLineEdit::showClearButton |
|
readwrite |
◆ showSearchIcon
bool QgsFilterLineEdit::showSearchIcon |
|
readwrite |
◆ showSpinner
bool QgsFilterLineEdit::showSpinner |
|
readwrite |
◆ value
QString QgsFilterLineEdit::value |
|
readwrite |
The documentation for this class was generated from the following files: