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:
Vadim Zeitlin
2019-01-23 16:45:21 +01:00
parent adee46d155
commit 6b3a0cc460

View File

@@ -154,7 +154,16 @@ public:
this, &wxQtSpinBox::valueChanged);
}
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 >
@@ -167,10 +176,7 @@ public:
this, &wxQtDoubleSpinBox::valueChanged);
}
private:
void valueChanged(double value);
};
void wxQtDoubleSpinBox::valueChanged(double value)
void valueChanged(double value)
{
wxControl *handler = GetHandler();
if ( handler )
@@ -180,6 +186,7 @@ void wxQtDoubleSpinBox::valueChanged(double value)
EmitEvent( event );
}
}
};
//##############################################################################
@@ -236,17 +243,6 @@ void wxSpinCtrl::SetValue( const wxString &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 >;