fixes bug when changing value by double click on fader/knob (#4018)

This commit is contained in:
Steffen Baranowsky
2017-11-30 16:57:15 +01:00
committed by GitHub
parent d0194e6c64
commit 898e7999dc
3 changed files with 8 additions and 36 deletions

View File

@@ -32,8 +32,7 @@ EqHandle::EqHandle( int num, int x, int y ):
m_width( x ),
m_heigth( y ),
m_mousePressed( false ),
m_active( false ),
m_handleMoved( false )
m_active( false )
{
setFlag( ItemIsMovable );
setFlag( ItemSendsGeometryChanges );
@@ -41,7 +40,6 @@ EqHandle::EqHandle( int num, int x, int y ):
float totalHeight = 36;
m_pixelsPerUnitHeight = ( m_heigth ) / ( totalHeight );
setMouseHover( false );
connect( this, SIGNAL( positionChanged() ), this, SLOT( handleMoved() ) );
}
@@ -93,14 +91,6 @@ float EqHandle::yPixelToGain(float y , int h, float pixelPerUnitHeight )
void EqHandle::handleMoved()
{
m_handleMoved = true;
}
void EqHandle::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
{
painter->setRenderHint( QPainter::Antialiasing, true );
@@ -189,6 +179,11 @@ void EqHandle::loadPixmap()
m_circlePixmap = PLUGIN_NAME::getIconPixmap( fileName.toLatin1() );
}
bool EqHandle::mousePressed() const
{
return m_mousePressed;
}
@@ -463,22 +458,6 @@ void EqHandle::setHandleActive( bool a )
void EqHandle::setHandleMoved( bool a )
{
m_handleMoved = a;
}
bool EqHandle::getHandleMoved()
{
return m_handleMoved;
}
void EqHandle::sethp12()
{
m_hp12 = true;

View File

@@ -71,8 +71,7 @@ public:
void setMouseHover( bool d );
bool isActiveHandle();
void setHandleActive( bool a );
void setHandleMoved(bool a);
bool getHandleMoved();
bool mousePressed() const;
void sethp12();
void sethp24();
void sethp48();
@@ -95,7 +94,6 @@ protected:
private:
double calculateGain( const double freq, const double a1, const double a2, const double b0, const double b1, const double b2 );
void loadPixmap();
float m_pixelsPerUnitWidth;
float m_pixelsPerUnitHeight;
float m_scale;
@@ -111,11 +109,7 @@ private:
float m_resonance;
bool m_mousePressed;
bool m_active;
bool m_handleMoved;
QPixmap m_circlePixmap;
private slots:
void handleMoved();
};

View File

@@ -104,7 +104,7 @@ void EqParameterWidget::updateHandle()
m_eqcurve->setModelChanged( true );
for( int i = 0 ; i < bandCount(); i++ )
{
if ( m_handleList->at( i )->getHandleMoved() == false ) //prevents a short circuit between handle and data model
if ( !m_handleList->at( i )->mousePressed() ) //prevents a short circuit between handle and data model
{
//sets the band on active if a fader or a knob is moved
bool hover = false; // prevents an action if handle is moved
@@ -126,7 +126,6 @@ void EqParameterWidget::updateHandle()
else
{
m_handleList->at( i )->setHandleActive( m_bands[i].active->value() );
m_handleList->at( i )->setHandleMoved( false );
}
}
if ( m_bands[0].hp12->value() ) m_handleList->at( 0 )->sethp12();