diff --git a/src/previewrenderer.cpp b/src/previewrenderer.cpp index 34452a1dd470f401978c97a02fb9358f31a74c25..3db0759fa6af37d723569ea9b1a84c35f43d3671 100644 --- a/src/previewrenderer.cpp +++ b/src/previewrenderer.cpp @@ -53,8 +53,8 @@ PreviewRenderer::paint(QPainter* painter) auto aspectRatio = static_cast<qreal>(previewImage->width()) / static_cast<qreal>(previewImage->height()); - auto previewHeight = height(); - auto previewWidth = previewHeight * aspectRatio; + auto previewHeight = aspectRatio < 1 ? height() : width() / aspectRatio; + auto previewWidth = aspectRatio < 1 ? previewHeight * aspectRatio : width(); /* Instead of setting fixed size, we could get an x offset for the preview * but this would render the horizontal spacers in the parent widget useless.