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. More...
|
|
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.
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 |
( |
QWidget * |
parent = nullptr , |
|
|
const QString & |
nullValue = QString() |
|
) |
| |
void QgsFilterLineEdit::cleared |
( |
| ) |
|
|
signal |
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.
void QgsFilterLineEdit::clearValue |
( |
| ) |
|
|
virtualslot |
QString QgsFilterLineEdit::defaultValue |
( |
| ) |
const |
|
inline |
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 208 of file qgsfilterlineedit.cpp.
void QgsFilterLineEdit::focusInEvent |
( |
QFocusEvent * |
e | ) |
|
|
overrideprotected |
bool QgsFilterLineEdit::isNull |
( |
| ) |
const |
|
inline |
void QgsFilterLineEdit::mouseReleaseEvent |
( |
QMouseEvent * |
e | ) |
|
|
overrideprotected |
QString QgsFilterLineEdit::nullValue |
( |
| ) |
const |
|
inline |
bool QgsFilterLineEdit::selectOnFocus |
( |
| ) |
const |
Will select all text when this widget receives the focus.
- Since
- QGIS 3.0
Definition at line 149 of file qgsfilterlineedit.cpp.
void QgsFilterLineEdit::selectOnFocusChanged |
( |
| ) |
|
|
signal |
Will select all text when this widget receives the focus.
- Since
- QGIS 3.0
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.
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
-
defaultValue | default value |
- See also
- defaultValue()
-
clearMode()
- Since
- QGIS 3.0
Definition at line 148 of file qgsfilterlineedit.h.
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.
void QgsFilterLineEdit::setSelectOnFocus |
( |
bool |
selectOnFocus | ) |
|
Will select all text when this widget receives the focus.
- Since
- QGIS 3.0
Definition at line 154 of file qgsfilterlineedit.cpp.
void QgsFilterLineEdit::setShowClearButton |
( |
bool |
visible | ) |
|
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 48 of file qgsfilterlineedit.cpp.
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 168 of file qgsfilterlineedit.cpp.
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.
bool QgsFilterLineEdit::showClearButton |
( |
| ) |
const |
|
inline |
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.
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
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
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.
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. |
friend class TestQgsFeatureListComboBox |
|
friend |
QString QgsFilterLineEdit::defaultValue |
|
readwrite |
QString QgsFilterLineEdit::nullValue |
|
readwrite |
bool QgsFilterLineEdit::showClearButton |
|
readwrite |
bool QgsFilterLineEdit::showSearchIcon |
|
readwrite |
bool QgsFilterLineEdit::showSpinner |
|
readwrite |
QString QgsFilterLineEdit::value |
|
readwrite |
The documentation for this class was generated from the following files: