18#ifndef QGSFILTERLINEEDIT_H
19#define QGSFILTERLINEEDIT_H
44 if ( qobject_cast<QgsFilterLineEdit *>( sipCpp ) )
45 sipType = sipType_QgsFilterLineEdit;
52 Q_PROPERTY(
ClearMode clearMode READ clearMode WRITE setClearMode )
53 Q_PROPERTY( QString nullValue READ nullValue WRITE setNullValue )
54 Q_PROPERTY( QString defaultValue READ defaultValue WRITE setDefaultValue )
55 Q_PROPERTY( QString value READ value WRITE setValue NOTIFY valueChanged )
56 Q_PROPERTY(
bool showClearButton READ showClearButton WRITE setShowClearButton )
57 Q_PROPERTY(
bool showSearchIcon READ showSearchIcon WRITE setShowSearchIcon )
58 Q_PROPERTY(
bool showSpinner READ showSpinner WRITE setShowSpinner NOTIFY showSpinnerChanged )
90 void setShowClearButton(
bool visible );
115 void setNullValue(
const QString &nullValue ) { mNullValue = nullValue; }
130 void setShowSearchIcon(
bool visible );
148 void setDefaultValue(
const QString &defaultValue );
167 void setValue(
const QString &value ) { setText( value.isNull() ? mNullValue : value ); }
177 QString
value()
const {
return isNull() ? QString() : text(); }
185 inline bool isNull()
const {
return text() == mNullValue; }
193 bool showSpinner()
const;
201 void setShowSpinner(
bool showSpinner );
208 bool selectOnFocus()
const;
215 void setSelectOnFocus(
bool selectOnFocus );
223 bool event( QEvent *event )
override;
238 virtual void clearValue();
284 void focusInEvent( QFocusEvent *e )
override;
285 void mouseReleaseEvent( QMouseEvent *e )
override;
288 void onTextChanged(
const QString &text );
289 void updateBusySpinner();
290 void updateClearIcon();
295 bool hasStateStored =
false;
303 QAction *mClearAction =
nullptr;
304 QAction *mSearchAction =
nullptr;
305 QAction *mBusySpinnerAction =
nullptr;
307 bool mClearButtonVisible =
true;
308 bool mShowSpinner =
false;
310 ClearMode mClearMode = ClearToNull;
313 QString mDefaultValue;
315 bool mWaitingForMouseRelease =
false;
316 bool mSelectOnFocus =
false;
318 LineEditState mLineEditState;
323 bool shouldShowClear()
const;
325 friend class TestQgsFeatureListComboBox;
342 QgsSpinBoxLineEdit( QWidget *parent =
nullptr )
351 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)