Skip to content
Snippets Groups Projects
Commit 9c0bba79 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

previewrender: do not overflow if ratio is greater than 1

Change-Id: Id7f443a354691d7b5b0a71e6e8b35a4cd0005a88
GitLab: #611
parent 335b2e5f
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment