Eq FloatText in widget display frequency

This commit is contained in:
Dave French
2014-12-29 19:46:12 +00:00
parent 76eba6456e
commit 89b3f8f98c
2 changed files with 15 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ EqParameterWidget::EqParameterWidget( QWidget *parent, EqControls * controls ) :
m_scale = 1.5;
m_pixelsPerOctave = freqToXPixel( 10000 ) - freqToXPixel( 5000 );
m_controls = controls;
tf = new TextFloat();
tf->hide();
}
@@ -154,6 +156,8 @@ void EqParameterWidget::mouseReleaseEvent( QMouseEvent *event )
{
m_controls->m_analyseOut = !m_controls->m_analyseOut;
}
tf->hide();
}
@@ -181,6 +185,15 @@ void EqParameterWidget::mouseMoveEvent( QMouseEvent *event )
break;
}
}
if( m_oldX > 0 && m_oldX < width() && m_oldY > 0 && m_oldY < height() )
{
tf->setText( QString::number(xPixelToFreq( m_oldX )) + tr( "Hz ") );
tf->show();
const int x = event->x() > width() * 0.5 ?
m_oldX - tf->width() :
m_oldX;
tf->moveGlobal(this, QPoint( x, m_oldY - tf->height() ) );
}
}

View File

@@ -27,6 +27,7 @@
#define EQPARAMETERWIDGET_H
#include <QWidget>
#include "EffectControls.h"
#include "TextFloat.h"
class EqControls;
@@ -121,6 +122,7 @@ private:
float m_pixelsPerOctave;
float m_scale;
EqBand* m_selectedBand;
TextFloat *tf;
EqBand* selectNearestHandle( const int x, const int y );