From 6b3a0cc460c56ab04d87945cf2b5e4d02cb62406 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 Jan 2019 16:45:21 +0100 Subject: [PATCH] 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 --- src/qt/spinctrl.cpp | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/qt/spinctrl.cpp b/src/qt/spinctrl.cpp index 5ea0ff9787..12ade77421 100644 --- a/src/qt/spinctrl.cpp +++ b/src/qt/spinctrl.cpp @@ -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,19 +176,17 @@ public: this, &wxQtDoubleSpinBox::valueChanged); } private: - void valueChanged(double value); -}; - -void wxQtDoubleSpinBox::valueChanged(double value) -{ - wxControl *handler = GetHandler(); - if ( handler ) + void valueChanged(double value) { - wxSpinDoubleEvent event( wxEVT_SPINCTRLDOUBLE, handler->GetId() ); - event.SetValue(value); - EmitEvent( event ); + wxControl *handler = GetHandler(); + if ( handler ) + { + 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 ))); } -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 >;