From e8e7940abe4b1e90010a1ee36e785f72a2de00cd Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Fri, 23 Jul 2021 17:45:35 +0800 Subject: [PATCH] fix: no longer display resolution info for image that not supported such info --- app/metadatamodel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/metadatamodel.cpp b/app/metadatamodel.cpp index 2c7b22d..7353c3b 100644 --- a/app/metadatamodel.cpp +++ b/app/metadatamodel.cpp @@ -40,10 +40,12 @@ void MetadataModel::setFile(const QString &imageFilePath) appendSection(QStringLiteral("GPS"), tr("GPS", "Section name.")); appendSection(QStringLiteral("File"), tr("File", "Section name.")); - appendProperty(QStringLiteral("Image"), QStringLiteral("Image.Dimensions"), - tr("Dimensions"), imageDimensionsString); - appendProperty(QStringLiteral("Image"), QStringLiteral("Image.SizeRatio"), - tr("Aspect ratio"), imageRatioString); + if (imgReader.supportsOption(QImageIOHandler::Size)) { + appendProperty(QStringLiteral("Image"), QStringLiteral("Image.Dimensions"), + tr("Dimensions"), imageDimensionsString); + appendProperty(QStringLiteral("Image"), QStringLiteral("Image.SizeRatio"), + tr("Aspect ratio"), imageRatioString); + } if (imgReader.supportsAnimation() && imgReader.imageCount() > 1) { appendProperty(QStringLiteral("Image"), QStringLiteral("Image.FrameCount"), tr("Frame count"), QString::number(imgReader.imageCount()));