Make wxQtSpinBoxBase-derived valueChanged() methods inline
It seems better to have them in the class itself, near the connect() call binding them. This also resolves an inconsistency between wxQtSpinBox::valueChanged(), which was defined elsewhere in the source file, and the same method of wxQtDoubleSpinBox, which was defined directly after the class declaration. See https://github.com/wxWidgets/wxWidgets/pull/1168
This commit is contained in:
@@ -154,7 +154,16 @@ public:
|
|||||||
this, &wxQtSpinBox::valueChanged);
|
this, &wxQtSpinBox::valueChanged);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void valueChanged(int value);
|
void valueChanged(int value)
|
||||||
|
{
|
||||||
|
wxControl *handler = GetHandler();
|
||||||
|
if ( handler )
|
||||||
|
{
|
||||||
|
wxSpinEvent event( wxEVT_SPINCTRL, handler->GetId() );
|
||||||
|
event.SetInt( value );
|
||||||
|
EmitEvent( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxQtDoubleSpinBox : public wxQtSpinBoxBase< QDoubleSpinBox >
|
class wxQtDoubleSpinBox : public wxQtSpinBoxBase< QDoubleSpinBox >
|
||||||
@@ -167,19 +176,17 @@ public:
|
|||||||
this, &wxQtDoubleSpinBox::valueChanged);
|
this, &wxQtDoubleSpinBox::valueChanged);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void valueChanged(double value);
|
void valueChanged(double value)
|
||||||
};
|
|
||||||
|
|
||||||
void wxQtDoubleSpinBox::valueChanged(double value)
|
|
||||||
{
|
|
||||||
wxControl *handler = GetHandler();
|
|
||||||
if ( handler )
|
|
||||||
{
|
{
|
||||||
wxSpinDoubleEvent event( wxEVT_SPINCTRLDOUBLE, handler->GetId() );
|
wxControl *handler = GetHandler();
|
||||||
event.SetValue(value);
|
if ( handler )
|
||||||
EmitEvent( event );
|
{
|
||||||
|
wxSpinDoubleEvent event( wxEVT_SPINCTRLDOUBLE, handler->GetId() );
|
||||||
|
event.SetValue(value);
|
||||||
|
EmitEvent( event );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
//##############################################################################
|
//##############################################################################
|
||||||
@@ -236,17 +243,6 @@ void wxSpinCtrl::SetValue( const wxString &value )
|
|||||||
qtSpinBox->setValue( qtSpinBox->valueFromText( wxQtConvertString( value )));
|
qtSpinBox->setValue( qtSpinBox->valueFromText( wxQtConvertString( value )));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxQtSpinBox::valueChanged(int value)
|
|
||||||
{
|
|
||||||
wxControl *handler = GetHandler();
|
|
||||||
if ( handler )
|
|
||||||
{
|
|
||||||
wxSpinEvent event( wxEVT_SPINCTRL, handler->GetId() );
|
|
||||||
event.SetInt( value );
|
|
||||||
EmitEvent( event );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//##############################################################################
|
//##############################################################################
|
||||||
|
|
||||||
template class wxSpinCtrlQt< double, QDoubleSpinBox >;
|
template class wxSpinCtrlQt< double, QDoubleSpinBox >;
|
||||||
|
Reference in New Issue
Block a user