Skip to content

Commit

Permalink
Merge pull request #3112 from vallsv/fix-colormap-redraw
Browse files Browse the repository at this point in the history
Fix mismatch between widget rect and paint update rect
  • Loading branch information
t20100 authored Jun 9, 2020
2 parents 2514a04 + e8966b2 commit a4b4117
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions silx/gui/widgets/LegendIconWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4b4117

Please sign in to comment.