From 244a7670e77d46ea395c6506083fc6f15f6f415a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 31 Oct 2024 01:31:08 +0100 Subject: [PATCH] Increase the distance precision for tracks < 10km/nm/nmi to two decimal digits --- src/GUI/format.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/GUI/format.cpp b/src/GUI/format.cpp index 36ec0bce..d444883f 100644 --- a/src/GUI/format.cpp +++ b/src/GUI/format.cpp @@ -52,6 +52,9 @@ QString Format::distance(qreal value, Units units) if (value < MIINM) return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "ft"); + else if (value < 10 * MIINM) + return l.toString(value * M2MI, 'f', 2) + UNIT_SPACE + + qApp->translate("Format", "mi"); else return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "mi"); @@ -59,6 +62,9 @@ QString Format::distance(qreal value, Units units) if (value < NMIINM) return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "ft"); + else if (value < 10 * NMIINM) + return l.toString(value * M2NMI, 'f', 2) + UNIT_SPACE + + qApp->translate("Format", "nmi"); else return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "nmi"); @@ -66,6 +72,9 @@ QString Format::distance(qreal value, Units units) if (value < KMINM) return l.toString(value, 'f', 0) + UNIT_SPACE + qApp->translate("Format", "m"); + else if (value < 10 * KMINM) + return l.toString(value * M2KM, 'f', 2) + UNIT_SPACE + + qApp->translate("Format", "km"); else return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE + qApp->translate("Format", "km");