diff options
| author | 2017-06-08 17:42:27 +0200 | |
|---|---|---|
| committer | 2017-06-08 17:42:27 +0200 | |
| commit | a39546a1325a2ab6413f462b161b718091114edd (patch) | |
| tree | a375db7e3b6f016fb09b2040cc65538c204fe89b | |
| parent | Use accept role better (diff) | |
| download | clockphoto-a39546a1325a2ab6413f462b161b718091114edd.tar.xz clockphoto-a39546a1325a2ab6413f462b161b718091114edd.zip | |
Deal with tall photos
| -rw-r--r-- | widget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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"); |
