diff --git a/include/wx/qt/spinbutt.h b/include/wx/qt/spinbutt.h index 6df89572e4..10771bc0bf 100644 --- a/include/wx/qt/spinbutt.h +++ b/include/wx/qt/spinbutt.h @@ -31,6 +31,7 @@ public: virtual int GetValue() const; virtual void SetValue(int val); + virtual void SetRange(int min, int max) wxOVERRIDE; virtual QWidget *GetHandle() const; diff --git a/src/qt/spinbutt.cpp b/src/qt/spinbutt.cpp index 7ae3c303fb..ec0de2b212 100644 --- a/src/qt/spinbutt.cpp +++ b/src/qt/spinbutt.cpp @@ -84,6 +84,8 @@ bool wxSpinButton::Create(wxWindow *parent, { m_qtSpinBox = new wxQtSpinButton( parent, this ); + m_qtSpinBox->setRange(wxSpinButtonBase::GetMin(), wxSpinButtonBase::GetMax()); + // Modify the size so that the text field is not visible. // TODO: Find out the width of the buttons i.e. take the style into account (QStyleOptionSpinBox). wxSize newSize( size ); @@ -92,6 +94,16 @@ bool wxSpinButton::Create(wxWindow *parent, return QtCreateControl( parent, id, pos, newSize, style, wxDefaultValidator, name ); } +void wxSpinButton::SetRange(int min, int max) +{ + wxSpinButtonBase::SetRange(min, max); // cache the values + + if ( m_qtSpinBox ) + { + m_qtSpinBox->setRange(min, max); + } +} + int wxSpinButton::GetValue() const { return m_qtSpinBox->value();