Fix display of bytes without decimals (#10595)

*Fixes #10594
This commit is contained in:
meigelb
2024-04-25 00:20:58 +02:00
committed by GitHub
parent 35af1c6695
commit 880621c1fb
3 changed files with 5 additions and 3 deletions

View File

@@ -138,7 +138,9 @@ namespace Tools
i++;
}
return QString("%1 %2").arg(QLocale().toString(size, 'f', precision), units.at(i));
// do not display decimals for smallest unit bytes identified by index i==0
const quint32 displayPrecision = (i == 0 ? 0 : precision);
return QString("%1 %2").arg(QLocale().toString(size, 'f', displayPrecision), units.at(i));
}
QString humanReadableTimeDifference(qint64 seconds)