Implement support for value range in wxQt wxSpinButton
Closes https://github.com/wxWidgets/wxWidgets/pull/1237
This commit is contained in:
committed by
Vadim Zeitlin
parent
e9813688ad
commit
0e3784c46e
@@ -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();
|
||||
|
Reference in New Issue
Block a user