16 #ifndef QGSDOUBLESPINBOX_H
17 #define QGSDOUBLESPINBOX_H
19 #include <QDoubleSpinBox>
23 class QgsSpinBoxLineEdit;
47 if ( qobject_cast<QgsDoubleSpinBox *>( sipCpp ) )
48 sipType = sipType_QgsDoubleSpinBox;
55 Q_PROPERTY(
bool showClearButton READ showClearButton WRITE setShowClearButton )
56 Q_PROPERTY(
bool clearValue READ clearValue WRITE setClearValue )
57 Q_PROPERTY(
bool expressionsEnabled READ expressionsEnabled WRITE setExpressionsEnabled )
81 void setShowClearButton(
bool showClearButton );
95 void setExpressionsEnabled(
bool enabled );
106 void clear()
override;
114 void setClearValue(
double customValue,
const QString &clearValueText = QString() );
121 void setClearValueMode( ClearValueMode mode,
const QString &clearValueText = QString() );
127 double clearValue()
const;
133 void setLineEditAlignment( Qt::Alignment alignment );
140 void setSpecialValueText(
const QString &txt );
142 double valueFromText(
const QString &text )
const override;
143 QValidator::State validate( QString &input,
int &pos )
const override;
144 void paintEvent( QPaintEvent *e )
override;
147 void changeEvent( QEvent *event )
override;
148 void wheelEvent( QWheelEvent *event )
override;
152 void timerEvent( QTimerEvent *event )
override;
155 void changed(
double value );
158 int frameWidth()
const;
159 bool shouldShowClearForValue(
double value )
const;
161 QgsSpinBoxLineEdit *mLineEdit =
nullptr;
163 bool mShowClearButton =
true;
164 ClearValueMode mClearValueMode = MinimumValue;
165 double mCustomClearValue = 0.0;
167 bool mExpressionsEnabled =
true;
169 QString stripped(
const QString &originalText )
const;
171 friend class TestQgsRangeWidgetWrapper;
174 #endif // QGSDOUBLESPINBOX_H