]> git.sesse.net Git - vlc/commitdiff
Qt: SoundSlider: fix text color contrast. (closes #5040)
authorFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 13 Jul 2011 12:50:35 +0000 (14:50 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 13 Jul 2011 13:17:41 +0000 (15:17 +0200)
Uses half hsv's value between background and foreground
(instead of mid palette color which is only revealant for drawing over
buttons colors)

modules/gui/qt4/util/input_slider.cpp

index c4d0fb49bfa93c56d86a205b455de807965c6522..53c93574d5eb51af427cf1b310daff7741b21a50 100644 (file)
@@ -619,7 +619,12 @@ void SoundSlider::paintEvent( QPaintEvent *e )
     const QRectF boundsO( 0, 0, pixOutside.width(), pixOutside.height() );
     painter.drawPixmap( boundsO, pixOutside, boundsO );
 
-    painter.setPen( palette().color( QPalette::Active, QPalette::Mid ) );
+    QColor background = palette().color( QPalette::Active, QPalette::Background );
+    QColor foreground = palette().color( QPalette::Active, QPalette::WindowText );
+    foreground.setHsv( foreground.hue(),
+                    ( background.saturation() + foreground.saturation() ) / 2,
+                    ( background.value() + foreground.value() ) / 2 );
+    painter.setPen( foreground );
     QFont font; font.setPixelSize( 9 );
     painter.setFont( font );
     const QRect rect( 0, 0, 34, 15 );