aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-08 17:42:27 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-06-08 17:42:27 +0200
commita39546a1325a2ab6413f462b161b718091114edd (patch)
treea375db7e3b6f016fb09b2040cc65538c204fe89b
parentUse accept role better (diff)
downloadclockphoto-a39546a1325a2ab6413f462b161b718091114edd.tar.xz
clockphoto-a39546a1325a2ab6413f462b161b718091114edd.zip
Deal with tall photos
-rw-r--r--widget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/widget.cpp b/widget.cpp
index f234aca..2340683 100644
--- a/widget.cpp
+++ b/widget.cpp
@@ -20,7 +20,11 @@ Widget::Widget(const QStringList &photos, const QString &dir, const QString &clo
else
layout->addWidget(new QLabel(tr("Adjusting dates for %1 photos in: <pre>%2</pre>").arg(photos.count()).arg(dir)));
QLabel *image = new QLabel;
- image->setPixmap(QPixmap(clockPhoto).scaledToWidth(800, Qt::SmoothTransformation));
+ const QPixmap photo(clockPhoto);
+ if (photo.height() > photo.width())
+ image->setPixmap(photo.scaledToHeight(800, Qt::SmoothTransformation));
+ else
+ image->setPixmap(photo.scaledToWidth(800, Qt::SmoothTransformation));
layout->addWidget(image);
QDateTimeEdit *date = new QDateTimeEdit;
date->setDisplayFormat("MMMM d, yyyy HH:mm:ss");