18#ifndef QGSFILTERLINEEDIT_H
19#define QGSFILTERLINEEDIT_H
43 if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
44 sipType = sipType_QgsFilterLineEdit;
51 Q_PROPERTY(
ClearMode clearMode READ clearMode WRITE setClearMode )
52 Q_PROPERTY( QString nullValue READ nullValue WRITE setNullValue )
53 Q_PROPERTY( QString defaultValue READ defaultValue WRITE setDefaultValue )
54 Q_PROPERTY( QString value READ value WRITE setValue NOTIFY valueChanged )
55 Q_PROPERTY(
bool showClearButton READ showClearButton WRITE setShowClearButton )
56 Q_PROPERTY(
bool showSearchIcon READ showSearchIcon WRITE setShowSearchIcon )
57 Q_PROPERTY(
bool showSpinner READ showSpinner WRITE setShowSpinner NOTIFY showSpinnerChanged )
86 void setShowClearButton(
bool visible );
109 void setNullValue(
const QString &nullValue ) { mNullValue = nullValue; }
123 void setShowSearchIcon(
bool visible );
139 void setDefaultValue(
const QString &defaultValue );
157 void setValue(
const QString &value ) { setText( value.isNull() ? mNullValue : value ); }
167 QString
value()
const {
return isNull() ? QString() : text(); }
175 inline bool isNull()
const {
return text() == mNullValue; }
182 bool showSpinner()
const;
189 void setShowSpinner(
bool showSpinner );
195 bool selectOnFocus()
const;
201 void setSelectOnFocus(
bool selectOnFocus );
208 bool event( QEvent *event )
override;
222 virtual void clearValue();
266 void focusInEvent( QFocusEvent *e )
override;
267 void mouseReleaseEvent( QMouseEvent *e )
override;
270 void onTextChanged(
const QString &text );
271 void updateBusySpinner();
272 void updateClearIcon();
277 bool hasStateStored =
false;
285 QAction *mClearAction =
nullptr;
286 QAction *mSearchAction =
nullptr;
287 QAction *mBusySpinnerAction =
nullptr;
289 bool mClearButtonVisible =
true;
290 bool mShowSpinner =
false;
292 ClearMode mClearMode = ClearToNull;
295 QString mDefaultValue;
297 bool mWaitingForMouseRelease =
false;
298 bool mSelectOnFocus =
false;
300 LineEditState mLineEditState;
305 bool shouldShowClear()
const;
307 friend class TestQgsFeatureListComboBox;
323 QgsSpinBoxLineEdit( QWidget *parent =
nullptr )
332 setCursor( Qt::IBeamCursor );
Animated icon is keeping an animation running if there are listeners connected to frameChanged.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
void focusInEvent(QFocusEvent *e) override
void selectOnFocusChanged()
Will select all text when this widget receives the focus.
void showSpinnerChanged()
Show a spinner icon.
ClearMode clearMode() const
Returns the clear mode for the widget.
bool showClearButton() const
Returns true if the widget's clear button is visible.
virtual void clearValue()
Clears the widget and resets it to the null value.
bool showSearchIcon() const
Returns if a search icon shall be shown on the left of the image when no text is entered.
ClearMode
Behavior when clearing value of widget.
@ ClearToDefault
Reset value to default value (see defaultValue() )
bool isNull() const
Determine if the current text represents null.
QString nullValue() const
Returns the string used for representing null values in the widget.
void setValue(const QString &value)
Sets the current text for the widget with support for handling null values.
bool hasStateStored() const
Returns if a state is already saved.
QString defaultValue() const
Returns the default value for the widget.
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
void cleared()
Emitted when the widget is cleared.
QString value() const
Returns the text of this edit with support for handling null values.
void setClearMode(ClearMode mode)
Sets the clear mode for the widget.
void valueChanged(const QString &value)
Same as textChanged() but with support for null values.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)