diff --git a/koordinates/gui/publisher_filter_widget.py b/koordinates/gui/publisher_filter_widget.py index 336eacd..9a19cd2 100644 --- a/koordinates/gui/publisher_filter_widget.py +++ b/koordinates/gui/publisher_filter_widget.py @@ -67,7 +67,7 @@ class PublisherDelegate(QStyledItemDelegate): VERTICAL_MARGIN = 7 HORIZONTAL_MARGIN = 5 THUMBNAIL_WIDTH = 118 - THUMBNAIL_MARGIN = 5 + THUMBNAIL_MARGIN = 8 def __init__(self, parent: Optional[QObject] = None): super().__init__(parent) @@ -144,10 +144,14 @@ def paint(self, painter: QPainter, option: QStyleOptionViewItem, if thumbnail_image and not thumbnail_image.isNull(): if publisher.publisher_type == PublisherType.Publisher: + max_thumbnail_width = int(thumbnail_rect.width()) \ + - 2 * self.THUMBNAIL_MARGIN + max_thumbnail_height = \ + int(min(thumbnail_rect.height(), + thumbnail_image.height())) \ + - 2 * self.THUMBNAIL_MARGIN scaled = thumbnail_image.scaled( - QSize( - int(thumbnail_rect.width()) - 2 * self.THUMBNAIL_MARGIN, - int(thumbnail_image.height()) - 2 * self.THUMBNAIL_MARGIN), + QSize(max_thumbnail_width, max_thumbnail_height), Qt.KeepAspectRatio, Qt.SmoothTransformation) else: