Skip to content
  • Adriaan de Groot's avatar
    Fix tooltip display of double (float) values. · 6d3527a3
    Adriaan de Groot authored and Arjen Hiemstra's avatar Arjen Hiemstra committed
    The port from KLocale -> QLocale left out the format-specifier
    in the call to QLocale::toString(double, char, int), so we
    ended up with the "precision" specifier as the char parameter --
    speficying the format char. It looks like 0 (NUL) is interpreted
    as 'f' on the Qt side, and precision is then 6.
    
    The result was tooltip output like "31,405,564.000000 KiB"
    which is nonsense -- there is no reason for six digits
    of precision when displaying KiB until such a time as
    micro-kibibytes ( 1/122 of a bit) are addressable.
    
    Force format 'f' to avoid scientific notation, and
    set precision to 0 for integer sensors, -1 (I assume that becomes
    6 again internally in QLocale::toString()) otherwise.
    The static_assert() is there as a reminder of which method
    in QLocale should be called here.
    6d3527a3