Commits

Aleš Erjavec committed 842c6ca

Keep aspect ratio of the images.

Comments (0)

Files changed (1)

Orange/OrangeWidgets/Data/OWImageViewer.py

 
     def setPixmap(self, pixmap):
         self.pixmapWidget.setPixmap(pixmap)
+        self._updatePixmapSize()
 
     def pixmap(self):
         return self.pixmapWidget.pixmap()
     def setThumbnailSize(self, size):
         if self._size != size:
             self._size = size
-            self.pixmapWidget.setPixmapSize(size)
+            self._updatePixmapSize()
             self.labelWidget.setTextWidth(max(100, size.width()))
 
     def setTitleWidth(self, width):
                                            self.geometry().size()), 3, 3)
             painter.restore()
 
+    def _updatePixmapSize(self):
+        pixsize = QSizeF(self.pixmap().size())
+        pixsize.scale(self._size, Qt.KeepAspectRatio)
+        self.pixmapWidget.setPixmapSize(pixsize)
+
 
 class ThumbnailWidget(QGraphicsWidget):