Commit 3efa2cf9 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

ImageViewer: No interpolation when zooming in

The imageViewer currently always renders the images smooth/interpolated.
When loading an image in an IDE and zooming in, I usually do that in
order to examine the details on pixel level. Therefore, I believe that
smoothing/interpolation should be turned off with a scalefactor >= 1.

This patch does that for images and movies. Svg files remain always

Change-Id: I327583b1f46132d179a1e0425f146106d962377b
Reviewed-by: default avatarDaniel Teske <>
parent 49707ff3
......@@ -69,7 +69,8 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
const bool smoothTransform = painter->worldTransform().m11() < 1;
painter->setRenderHint(QPainter::SmoothPixmapTransform, smoothTransform);
painter->drawPixmap(offset(), m_movie->currentPixmap());
......@@ -257,6 +258,9 @@ void ImageView::doScale(qreal factor)
scale(actualFactor, actualFactor);
if (QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(d->imageItem))
transform().m11() < 1 ? Qt::SmoothTransformation : Qt::FastTransformation);
void ImageView::updatePixmap(const QRect &rect)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment