From af8cccc1cd0b7b0edd403d71096840ac16bfa1be Mon Sep 17 00:00:00 2001 From: narunlifescience Date: Tue, 15 Sep 2015 16:43:52 -0500 Subject: [PATCH] theme change check inside paint event --- src/widgets/sliderwidget.cpp | 7 ++++++- src/widgets/sliderwidget.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widgets/sliderwidget.cpp b/src/widgets/sliderwidget.cpp index b2f92ab9f..1c7071f45 100644 --- a/src/widgets/sliderwidget.cpp +++ b/src/widgets/sliderwidget.cpp @@ -198,6 +198,8 @@ Amarok::VolumeSlider::VolumeSlider(QWidget* parent, uint max) m_pixmapInset(QPixmap(volumePixmapDraw ())) { setFocusPolicy(Qt::NoFocus); + WindowText_color = palette().color(QPalette::WindowText); + // BEGIN Calculate handle animation pixmaps for mouse-over effect QImage pixmapHandle(":volumeslider-handle.png"); QImage pixmapHandleGlow(":volumeslider-handle_glow.png"); @@ -301,7 +303,10 @@ void Amarok::VolumeSlider::paintEvent(QPaintEvent*) { const int padding = 7; const int offset = int(double((width() - 2 * padding) * value()) / maximum()); - m_pixmapInset = volumePixmapDraw(); + if (WindowText_color != palette().color(QPalette::WindowText)) { + m_pixmapInset = volumePixmapDraw(); + WindowText_color = palette().color(QPalette::WindowText); + } p.drawPixmap(0, 0, m_pixmapGradient, 0, 0, offset + padding, 0); p.drawPixmap(0, 0, m_pixmapInset); diff --git a/src/widgets/sliderwidget.h b/src/widgets/sliderwidget.h index 00823c0ac..218e42be9 100644 --- a/src/widgets/sliderwidget.h +++ b/src/widgets/sliderwidget.h @@ -130,6 +130,8 @@ class VolumeSlider : public Slider { QPixmap m_pixmapInset; QPixmap m_pixmapGradient; + QColor WindowText_color; + QList m_handlePixmaps; }; }