Commit b50c1cab authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Small Sound Slider issue fixed.

parent d03eb707
...@@ -215,7 +215,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event ) ...@@ -215,7 +215,7 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
} }
else else
{ {
int i = ( event->x() - paddingL ) * maximum() / WLENGTH; int i = ( ( event->x() - paddingL ) * maximum() + 40 ) / WLENGTH;
i = __MIN( __MAX( 0, i ), maximum() ); i = __MIN( __MAX( 0, i ), maximum() );
setToolTip( QString("%1 \%" ).arg( i ) ); setToolTip( QString("%1 \%" ).arg( i ) );
} }
...@@ -223,15 +223,13 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event ) ...@@ -223,15 +223,13 @@ void SoundSlider::mouseMoveEvent( QMouseEvent *event )
void SoundSlider::changeValue( int x ) void SoundSlider::changeValue( int x )
{ {
setValue( x * maximum() / WLENGTH ); setValue( (x * maximum() + 40 ) / WLENGTH );
} }
void SoundSlider::paintEvent(QPaintEvent *e) void SoundSlider::paintEvent(QPaintEvent *e)
{ {
QPainter painter( this ); QPainter painter( this );
const int offset = int( const int offset = int( ( WLENGTH * value() + 100 ) / maximum() ) + paddingL;
double( WLENGTH * value() ) /
double( maximum() ) ) + paddingL;
const QRectF boundsG( 0, 0, offset , pixGradient.height() ); const QRectF boundsG( 0, 0, offset , pixGradient.height() );
painter.drawPixmap( boundsG, pixGradient, boundsG ); painter.drawPixmap( boundsG, pixGradient, boundsG );
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
virtual ~SoundSlider() {}; virtual ~SoundSlider() {};
protected: protected:
const static int paddingL = 4; const static int paddingL = 3;
const static int paddingR = 2; const static int paddingR = 2;
virtual void paintEvent(QPaintEvent *); virtual void paintEvent(QPaintEvent *);
virtual void wheelEvent( QWheelEvent *event ); virtual void wheelEvent( QWheelEvent *event );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment