From fd65a1404c228340ed53bbb4137db5180a1e8a6e Mon Sep 17 00:00:00 2001 From: Florian Zwoch Date: Fri, 9 Feb 2024 13:40:54 +0100 Subject: [PATCH] UI: Fill audio meter background each update (#9842) Since the widget is marked as opaque we need to draw each pixel or else we may end up with unpainted pixels. On Wayland this will result in artifacts in the audio meter as transparent pixels will pick up colors from the underlaying desktop instead. --- UI/volume-control.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/UI/volume-control.cpp b/UI/volume-control.cpp index 9303f78dc..88477300f 100644 --- a/UI/volume-control.cpp +++ b/UI/volume-control.cpp @@ -1417,6 +1417,10 @@ void VolumeMeter::paintEvent(QPaintEvent *event) QPainter painter(this); + // Paint window background color (as widget is opaque) + QColor background = palette().color(QPalette::ColorRole::Window); + painter.fillRect(event->region().boundingRect(), background); + if (vertical) height -= METER_PADDING * 2; @@ -1426,11 +1430,6 @@ void VolumeMeter::paintEvent(QPaintEvent *event) if (needLayoutChange()) doLayout(); - // Paint window background color (as widget is opaque) - QColor background = - palette().color(QPalette::ColorRole::Window); - painter.fillRect(widgetRect, background); - if (vertical) { paintVTicks(painter, displayNrAudioChannels *