fix(qt): render the value readout in the format the attribute declared - #58
Merged
Conversation
The industrial readout always rendered fixed, whatever the attribute
asked for. HydraulicParticle declares its rates as "{:.2e}" over
[1e-6, 1e-1] precisely so the readout stays a short mantissa and an
exponent; rendered fixed, 1e-3 becomes 0.00100000, overruns the value
field and clips to a run of zeroes with no decimal point visible. That
is the 000001 in the reported screenshot.
The whole spec is kept now rather than being reduced to a decimal count,
and a spec whose presentation type is e, E, g or G is rendered through
std::vformat. Everything else still goes through display_float, which
widens precision rather than letting a small non-zero value round away
to 0.00, so the fixed case keeps the behaviour it was given.
A malformed spec falls back rather than throwing: that is a host bug and
not a reason for a row to render nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the readout always rendered fixed no matter what the attribute asked for.
HydraulicParticle declares its rates as "{:.2e}" over [1e-6, 1e-1] exactly so
the readout stays a short mantissa plus an exponent. rendered fixed, 1e-3 comes
out as 0.00100000, overruns the value field and clips to a run of zeroes with
no decimal point left in it, which is the 000001 you saw.
it keeps the whole spec now instead of reducing it to a decimal count, and
anything whose presentation type is e/E/g/G goes through std::vformat.
everything else still goes through display_float so a small value under a fixed
spec keeps widening rather than rounding away to 0.00. a malformed spec falls
back instead of throwing.
test_slider_mapping covers both, "{:.2e}" on 1e-3 now reads 1.00e-03 and
"{:.2f}" on 0.001 still reads 0.001.
worth saying: the log rail itself was already fixed in #57, hesiod dev was just
still pinned at the merge of #56 so none of it was in your build. bump is
ottolink-dev/Hesiod#753.