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 )
88 void setShowClearButton(
bool visible );
111 void setNullValue(
const QString &nullValue ) { mNullValue = nullValue; }
125 void setShowSearchIcon(
bool visible );
141 void setDefaultValue(
const QString &defaultValue );
159 void setValue(
const QString &value ) { setText( value.isNull() ? mNullValue : value ); }
169 QString
value()
const {
return isNull() ? QString() : text(); }
177 inline bool isNull()
const {
return text() == mNullValue; }
184 bool showSpinner()
const;
191 void setShowSpinner(
bool showSpinner );
197 bool selectOnFocus()
const;
203 void setSelectOnFocus(
bool selectOnFocus );
210 bool event( QEvent *event )
override;
224 virtual void clearValue();
268 void focusInEvent( QFocusEvent *e )
override;
269 void mouseReleaseEvent( QMouseEvent *e )
override;
272 void onTextChanged(
const QString &text );
273 void updateBusySpinner();
274 void updateClearIcon();
279 bool hasStateStored =
false;
287 QAction *mClearAction =
nullptr;
288 QAction *mSearchAction =
nullptr;
289 QAction *mBusySpinnerAction =
nullptr;
291 bool mClearButtonVisible =
true;
292 bool mShowSpinner =
false;
294 ClearMode mClearMode = ClearToNull;
297 QString mDefaultValue;
299 bool mWaitingForMouseRelease =
false;
300 bool mSelectOnFocus =
false;
302 LineEditState mLineEditState;
307 bool shouldShowClear()
const;
309 friend class TestQgsFeatureListComboBox;
326 QgsSpinBoxLineEdit( QWidget *parent =
nullptr )
335 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)