From e8966b258e2aa3822d0afb2f76a81fe0fb1f5ab7 Mon Sep 17 00:00:00 2001 From: Valentin Valls Date: Tue, 9 Jun 2020 14:25:04 +0200 Subject: [PATCH] Fix mismatch between widget rect and paint update rect --- silx/gui/widgets/LegendIconWidget.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/silx/gui/widgets/LegendIconWidget.py b/silx/gui/widgets/LegendIconWidget.py index 1a403cb375..1c95e4136a 100755 --- a/silx/gui/widgets/LegendIconWidget.py +++ b/silx/gui/widgets/LegendIconWidget.py @@ -336,10 +336,11 @@ def paint(self, painter, rect, palette): pixmapRect = qt.QRect(0, 0, _COLORMAP_PIXMAP_SIZE, 1) widthMargin = 0 halfHeight = 4 + widgetRect = self.rect() dest = qt.QRect( - rect.left() + widthMargin, - rect.center().y() - halfHeight + 1, - rect.width() - widthMargin * 2, + widgetRect.left() + widthMargin, + widgetRect.center().y() - halfHeight + 1, + widgetRect.width() - widthMargin * 2, halfHeight * 2, ) painter.drawImage(dest, image, pixmapRect)