[vlc-commits] Qt4: change the handle size and color

Ludovic Fauvet git at videolan.org
Sat Apr 16 14:23:17 CEST 2011


vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Fri Apr 15 23:40:15 2011 +0200| [e50346b14916da12a136f0c0dc629dc35df766d1] | committer: Jean-Baptiste Kempf

Qt4: change the handle size and color

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e50346b14916da12a136f0c0dc629dc35df766d1
---

 modules/gui/qt4/util/input_slider.cpp |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 1ae09c1..0028180 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -37,6 +37,7 @@
 #include <QStyleOptionSlider>
 #include <QLinearGradient>
 #include <QTimer>
+#include <QRadialGradient>
 
 #define MINIMUM 0
 #define MAXIMUM 1000
@@ -288,32 +289,31 @@ void SeekSlider::paintEvent( QPaintEvent *event )
 
     // draw handle
     if ( option.state & QStyle::State_MouseOver ) {
-        QLinearGradient buttonGradient( 0, 0, 0, height() );
-        buttonGradient.setColorAt( 0.0, QColor( 1, 92, 195 ) );
-        buttonGradient.setColorAt( 0.40, QColor( 41, 80, 124 ) );
-        buttonGradient.setColorAt( 1.0, QColor( 1, 92, 195 ) );
-
-        painter.setPen( QPen( Qt::blue ) );
-        painter.setBrush( buttonGradient );
 
         if ( sliderPos != -1 ) {
             const int margin = 5;
-            QSize hs = handleSize() -QSize( 2, 2 );
+            QSize hs = handleSize() -QSize( 5, 5 );
             QPoint pos;
 
             switch ( orientation() ) {
                 case Qt::Horizontal:
-                    pos = QPoint( sliderPos -( handleSize().width() /2 ), 1 );
+                    pos = QPoint( sliderPos -( hs.width() /2 ), 2 );
                     pos.rx() = qMax( margin, pos.x() );
                     pos.rx() = qMin( width() -hs.width() -margin, pos.x() );
                     break;
                 case Qt::Vertical:
-                    pos = QPoint( 1, height() -( sliderPos +( handleSize().height() /2 ) ) );
+                    pos = QPoint( 2, height() -( sliderPos +( hs.height() /2 ) ) );
                     pos.ry() = qMax( margin, pos.y() );
                     pos.ry() = qMin( height() -hs.height() -margin, pos.y() );
                     break;
             }
 
+            QRadialGradient buttonGradient( pos.x() + ( hs.width() / 2 ) - 2, pos.y() + ( hs.height() / 2 ) - 2, qMax( hs.width(), hs.height() ) );
+            buttonGradient.setColorAt( 0.0, QColor(  0,  0,  0 ) );
+            buttonGradient.setColorAt( 1.0, QColor( 80, 80, 80 ) );
+
+            painter.setPen( Qt::NoPen );
+            painter.setBrush( buttonGradient );
             painter.drawEllipse( pos.x(), pos.y(), hs.width(), hs.height() );
         }
     }



More information about the vlc-commits mailing list