[vlc-commits] Qt: SoundSlider: fix text color contrast. (closes #5040)

Francois Cartegnie git at videolan.org
Wed Jul 13 15:17:54 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 13 14:50:35 2011 +0200| [d947748663b69af8bb5549439a986ef3217b6c70] | committer: Francois Cartegnie

Qt: SoundSlider: fix text color contrast. (closes #5040)

Uses half hsv's value between background and foreground
(instead of mid palette color which is only revealant for drawing over
buttons colors)

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

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

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index c4d0fb4..53c9357 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -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 );



More information about the vlc-commits mailing list