From 132ab41e5d4f23019a07e815f0a3aae7a4ce1939 Mon Sep 17 00:00:00 2001 From: NoiseByNorthwest Date: Thu, 26 Jan 2012 00:38:46 +0100 Subject: [PATCH] Replace static var by property, see "Add magnetic effect..." commit --- include/knob.h | 2 ++ src/gui/widgets/knob.cpp | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/knob.h b/include/knob.h index 3e13dec64..aa2767cb4 100644 --- a/include/knob.h +++ b/include/knob.h @@ -151,6 +151,8 @@ private: QPoint m_origMousePos; bool m_buttonPressed; + int m_magneticDecay; + float m_totalAngle; int m_angle; QImage m_cache; diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 0df4a8b6d..efb4b6e0b 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -63,6 +63,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) : m_volumeKnob( false ), m_mouseOffset( 0.0f ), m_buttonPressed( false ), + m_magneticDecay( 0 ), m_angle( -10 ), m_outerColor( NULL ) { @@ -563,11 +564,9 @@ void knob::setPosition( const QPoint & _p ) if( model()->initValue() == current ) { - // not critical but should be a property - static int magnet_dec = 0; - if( ++magnet_dec > 20 ) + if( ++m_magneticDecay > 20 ) { - magnet_dec = 0; + m_magneticDecay = 0; model()->setValue( next ); }