]> git.sesse.net Git - vlc/commitdiff
Qt4 - Make the gradient fit INSIDE the boundaries...
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 26 Nov 2007 06:58:18 +0000 (06:58 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 26 Nov 2007 06:58:18 +0000 (06:58 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/util/input_slider.cpp

index a9235a89ef0ae1b3413e3659bcd773becd4f5d58..5e7adda5290ea5b113a7c7a32175010137bef6d8 100644 (file)
@@ -522,7 +522,7 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
         volumeSlider->setOrientation( Qt::Horizontal );
     }
     volumeSlider->setMaximumSize( QSize( 200, 40 ) );
-    volumeSlider->setMinimumSize( QSize( 80, 20 ) );
+    volumeSlider->setMinimumSize( QSize( 106, 30 ) );
     volumeSlider->setFocusPolicy( Qt::NoFocus );
     controlLayout->addWidget( volumeSlider, 2, 16, 2 , 2, Qt::AlignBottom );
 
index 055c66d1739781a527b4cf48f52a23dd1a18342d..59f205f3f40f16d0c42673641c366ad051d1d4d1 100644 (file)
@@ -84,6 +84,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
                         : QAbstractSlider( _parent )
 {
     padding = 3;
+    
     f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ;
     setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX  );
 
@@ -91,11 +92,13 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
 
     const QPixmap temp( ":/pixmaps/volume-slider-inside.png" );
     const QBitmap mask( temp.createHeuristicMask() );
+    
+    setMinimumSize( pixOutside.size() );
 
     pixGradient = QPixmap( mask.size() );
 
     QPainter p( &pixGradient );
-    QLinearGradient gradient( 0, padding, WLENGTH + 2 * padding, padding );
+    QLinearGradient gradient( padding, 2, WLENGTH , 2 );
     gradient.setColorAt( 0.0, Qt::white );
     gradient.setColorAt( 0.2, QColor( 20, 226, 20 ) );
     gradient.setColorAt( 0.5, QColor( 255, 176, 15 ) );
@@ -175,7 +178,8 @@ void SoundSlider::paintEvent(QPaintEvent *e)
 {
     QPainter painter( this );
     const int offset = int( double( ( width() - 2 * padding ) * value() ) / maximum() );
-    const QRectF boundsG( padding, padding, offset , pixGradient.height() );
+        
+    const QRectF boundsG( 0, 0, offset , pixGradient.height() );
     painter.drawPixmap( boundsG, pixGradient, boundsG );
 
     const QRectF boundsO( 0, 0, pixOutside.width(), pixOutside.height() );