16 #ifndef QGSDOUBLESPPINBOX_H
17 #define QGSDOUBLESPPINBOX_H
19 #include <QDoubleSpinBox>
20 #include <QToolButton>
30 Q_PROPERTY(
bool showClearButton READ showClearButton WRITE setShowClearButton )
31 Q_PROPERTY(
bool expressionsEnabled READ expressionsEnabled WRITE setExpressionsEnabled )
45 void setShowClearButton(
const bool showClearButton );
53 void setExpressionsEnabled(
const bool enabled );
62 virtual void clear()
override;
69 void setClearValue(
double customValue, QString clearValueText = QString() );
75 void setClearValueMode( ClearValueMode mode, QString clearValueText = QString() );
78 double clearValue()
const;
80 virtual double valueFromText(
const QString & text )
const override;
81 virtual QValidator::State validate( QString & input,
int & pos )
const override;
84 virtual void resizeEvent( QResizeEvent* event )
override;
85 virtual void changeEvent( QEvent* event )
override;
86 virtual void paintEvent( QPaintEvent* event )
override;
89 void changed(
const double &value );
92 int frameWidth()
const;
93 bool shouldShowClearForValue(
const double value )
const;
95 bool mShowClearButton;
96 ClearValueMode mClearValueMode;
97 double mCustomClearValue;
99 bool mExpressionsEnabled;
101 QToolButton* mClearButton;
102 QString stripped(
const QString &originalText )
const;
105 #endif // QGSDOUBLESPPINBOX_H