diff --git a/autotests/propertyinfotest.cpp b/autotests/propertyinfotest.cpp --- a/autotests/propertyinfotest.cpp +++ b/autotests/propertyinfotest.cpp @@ -132,6 +132,8 @@ { Property::PhotoGpsLongitude, true, 13.5, QStringLiteral("13.5") + QChar(0x00B0)}, { Property::PhotoExposureTime, true, 0.0015625, QStringLiteral("0.00156")}, { Property::PhotoExposureBiasValue, true, 0.3333333, QStringLiteral("0.333")}, + { Property::PhotoFNumber, true, 4.0, QStringLiteral("f/4")}, + { Property::PhotoFNumber, true, 2.8, QStringLiteral("f/2.8")}, { Property::ReplayGainAlbumGain, true, -9.90, QStringLiteral("-9.9")}, { Property::ReplayGainAlbumPeak, true, 1.512, QStringLiteral("1.51")}, { Property::ReplayGainAlbumGain, true, 10.44, QStringLiteral("10.4")}, diff --git a/src/formatstrings.cpp b/src/formatstrings.cpp --- a/src/formatstrings.cpp +++ b/src/formatstrings.cpp @@ -162,3 +162,8 @@ { return i18nc("Aspect ratio, normalized to one", "%1:1", QLocale().toString(round(value.toDouble() * 100) / 100)); } + +QString FormatStrings::formatAsFNumber(const QVariant& value) +{ + return i18nc("F number for photographs", "f/%1", QLocale().toString(value.toDouble(), 'g', 2)); +} diff --git a/src/formatstrings_p.h b/src/formatstrings_p.h --- a/src/formatstrings_p.h +++ b/src/formatstrings_p.h @@ -53,6 +53,8 @@ static QString formatAspectRatio(const QVariant& value); + static QString formatAsFNumber(const QVariant& value); + }; } diff --git a/src/propertyinfo.cpp b/src/propertyinfo.cpp --- a/src/propertyinfo.cpp +++ b/src/propertyinfo.cpp @@ -237,7 +237,7 @@ d->name = QStringLiteral("photoApertureValue"); d->displayName = i18nc("@label EXIF", "Photo Aperture Value"); d->valueType = QVariant::Double; - d->formatAsString = &FormatStrings::formatDouble; + d->formatAsString = &FormatStrings::formatAsFNumber; break; case Property::PhotoDateTimeOriginal: @@ -271,7 +271,8 @@ case Property::PhotoFNumber: d->name = QStringLiteral("photoFNumber"); d->displayName = i18nc("@label EXIF", "Photo F Number"); - d->valueType = QVariant::Int; + d->valueType = QVariant::Double; + d->formatAsString = &FormatStrings::formatAsFNumber; break; case Property::PhotoFocalLength: