16#ifndef QGSDOUBLESPINBOX_H
17#define QGSDOUBLESPINBOX_H
19#include <QDoubleSpinBox>
23class 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 );
94 void setExpressionsEnabled(
bool enabled );
104 void clear()
override;
112 void setClearValue(
double customValue,
const QString &clearValueText = QString() );
119 void setClearValueMode( ClearValueMode mode,
const QString &clearValueText = QString() );
125 double clearValue()
const;
131 void setLineEditAlignment( Qt::Alignment alignment );
138 void setSpecialValueText(
const QString &txt );
140 double valueFromText(
const QString &text )
const override;
141 QValidator::State validate( QString &input,
int &pos )
const override;
142 void paintEvent( QPaintEvent *e )
override;
145 void changeEvent( QEvent *event )
override;
146 void wheelEvent( QWheelEvent *event )
override;
150 void timerEvent( QTimerEvent *event )
override;
153 void changed(
double value );
156 int frameWidth()
const;
157 bool shouldShowClearForValue(
double value )
const;
159 QgsSpinBoxLineEdit *mLineEdit =
nullptr;
161 bool mShowClearButton =
true;
162 ClearValueMode mClearValueMode = MinimumValue;
163 double mCustomClearValue = 0.0;
165 bool mExpressionsEnabled =
true;
167 QString stripped(
const QString &originalText )
const;
169 friend class TestQgsRangeWidgetWrapper;
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
bool showClearButton() const
Returns whether the widget is showing a clear button.
ClearValueMode
Behavior when widget is cleared.
@ MaximumValue
Reset value to maximum()
@ CustomValue
Reset value to custom value (see setClearValue() )
@ MinimumValue
Reset value to minimum()
bool expressionsEnabled() const
Returns whether the widget will allow entry of simple expressions, which are evaluated and then disca...
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)