1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-23 08:20:01 +01:00

theme change check inside paint event

This commit is contained in:
narunlifescience 2015-09-15 16:43:52 -05:00
parent e269f7ae40
commit af8cccc1cd
2 changed files with 8 additions and 1 deletions

View File

@ -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);

View File

@ -130,6 +130,8 @@ class VolumeSlider : public Slider {
QPixmap m_pixmapInset;
QPixmap m_pixmapGradient;
QColor WindowText_color;
QList<QPixmap> m_handlePixmaps;
};
}