fix: no longer display resolution info for image that not supported such info

This commit is contained in:
Gary Wang 2021-07-23 17:45:35 +08:00
parent c5e48d07ed
commit e8e7940abe

View File

@ -40,10 +40,12 @@ void MetadataModel::setFile(const QString &imageFilePath)
appendSection(QStringLiteral("GPS"), tr("GPS", "Section name.")); appendSection(QStringLiteral("GPS"), tr("GPS", "Section name."));
appendSection(QStringLiteral("File"), tr("File", "Section name.")); appendSection(QStringLiteral("File"), tr("File", "Section name."));
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.Dimensions"), if (imgReader.supportsOption(QImageIOHandler::Size)) {
tr("Dimensions"), imageDimensionsString); appendProperty(QStringLiteral("Image"), QStringLiteral("Image.Dimensions"),
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.SizeRatio"), tr("Dimensions"), imageDimensionsString);
tr("Aspect ratio"), imageRatioString); appendProperty(QStringLiteral("Image"), QStringLiteral("Image.SizeRatio"),
tr("Aspect ratio"), imageRatioString);
}
if (imgReader.supportsAnimation() && imgReader.imageCount() > 1) { if (imgReader.supportsAnimation() && imgReader.imageCount() > 1) {
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.FrameCount"), appendProperty(QStringLiteral("Image"), QStringLiteral("Image.FrameCount"),
tr("Frame count"), QString::number(imgReader.imageCount())); tr("Frame count"), QString::number(imgReader.imageCount()));