aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browsertab.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index 8541730..88ccc91 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -720,8 +720,12 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
this->ui->graphics_browser->setScene(&graphics_scene);
- connect(&graphics_scene, &QGraphicsScene::changed, this, [this]() {
- this->ui->graphics_browser->fitInView(graphics_scene.sceneRect(), Qt::KeepAspectRatio);
+ connect(&graphics_scene, &QGraphicsScene::changed, this, [=]() {
+ QSize imageSize = pixmap.size();
+ QSize browserSize = this->ui->graphics_browser->sizeHint();
+
+ if (imageSize.width() > browserSize.width() || imageSize.height() > browserSize.height())
+ this->ui->graphics_browser->fitInView(graphics_scene.sceneRect(), Qt::KeepAspectRatio);
});
will_cache = false;