2014-09-25 15:08:51 +02:00
|
|
|
class QgsSpinBox : QSpinBox
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgsspinbox.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
2014-12-04 08:45:22 +01:00
|
|
|
enum ClearValueMode
|
2014-12-03 11:24:32 +01:00
|
|
|
{
|
|
|
|
MinimumValue,
|
|
|
|
MaximumValue,
|
|
|
|
CustomValue
|
2014-12-08 21:30:29 +01:00
|
|
|
};
|
|
|
|
|
2014-09-25 15:08:51 +02:00
|
|
|
explicit QgsSpinBox( QWidget *parent /TransferThis/ = 0 );
|
|
|
|
|
|
|
|
//! determines if the widget will show a clear button
|
|
|
|
//! @note the clear button will set the widget to its minimum value
|
|
|
|
void setShowClearButton( const bool showClearButton );
|
|
|
|
bool showClearButton() const;
|
2014-12-08 21:30:29 +01:00
|
|
|
|
2014-12-05 23:39:50 +11:00
|
|
|
/**Sets if the widget will allow entry of simple expressions, which are
|
|
|
|
* evaluated and then discarded.
|
|
|
|
* @param enabled set to true to allow expression entry
|
|
|
|
* @note added in QGIS 2.7
|
|
|
|
*/
|
|
|
|
void setExpressionsEnabled( const bool enabled );
|
|
|
|
/**Returns whether the widget will allow entry of simple expressions, which are
|
|
|
|
* evaluated and then discarded.
|
|
|
|
* @returns true if spin box allows expression entry
|
|
|
|
* @note added in QGIS 2.7
|
|
|
|
*/
|
|
|
|
bool expressionsEnabled() const;
|
2014-09-25 15:08:51 +02:00
|
|
|
|
2014-12-03 11:24:32 +01:00
|
|
|
//! Set the current value to the value defined by the clear value.
|
2014-09-25 15:08:51 +02:00
|
|
|
virtual void clear();
|
|
|
|
|
2014-12-03 11:24:32 +01:00
|
|
|
/**
|
2014-12-04 23:07:27 +11:00
|
|
|
* @brief setClearValue defines the clear value for the widget and will automatically set the clear value mode to CustomValue
|
|
|
|
* @param customValue defines the numerical value used as the clear value
|
2014-12-04 08:45:22 +01:00
|
|
|
* @param clearValueText is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.
|
2014-12-03 11:24:32 +01:00
|
|
|
*/
|
2014-12-04 08:45:22 +01:00
|
|
|
void setClearValue( int customValue, QString clearValueText = QString() );
|
|
|
|
/**
|
|
|
|
* @brief setClearValueMode defines if the clear value should be the minimum or maximum values of the widget or a custom value
|
2014-12-04 23:07:27 +11:00
|
|
|
* @param mode mode to user for clear value
|
2014-12-04 08:45:22 +01:00
|
|
|
* @param clearValueText is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.
|
|
|
|
*/
|
|
|
|
void setClearValueMode( ClearValueMode mode, QString clearValueText = QString() );
|
|
|
|
|
2014-12-03 11:24:32 +01:00
|
|
|
//! returns the value used when clear() is called.
|
2014-12-04 21:19:43 +11:00
|
|
|
int clearValue() const;
|
2014-12-03 11:24:32 +01:00
|
|
|
|
2014-12-05 23:39:50 +11:00
|
|
|
virtual int valueFromText( const QString & text ) const;
|
|
|
|
virtual QValidator::State validate( QString & input, int & pos ) const;
|
2014-12-08 21:30:29 +01:00
|
|
|
|
2014-09-25 15:08:51 +02:00
|
|
|
protected:
|
|
|
|
virtual void resizeEvent( QResizeEvent* event );
|
2014-11-13 23:13:13 +01:00
|
|
|
virtual void changeEvent( QEvent* event );
|
2014-09-25 15:08:51 +02:00
|
|
|
};
|