Clean up: refactor handling and display decimal places#2850
Open
ybott-qinetic wants to merge 4 commits intottomkins/unit-refactorfrom
Open
Clean up: refactor handling and display decimal places#2850ybott-qinetic wants to merge 4 commits intottomkins/unit-refactorfrom
ybott-qinetic wants to merge 4 commits intottomkins/unit-refactorfrom
Conversation
chriadam
reviewed
Mar 2, 2026
| precision: 2 | ||
| precisionAdjustmentAllowed: false | ||
| decimals: 2 | ||
| formatHints: Units.DecimalsAdjustmentAllowed |
Contributor
There was a problem hiding this comment.
Is the flag supposed to be DecimalsAdjustmentDisallowed? If not, this change inverts the current behaviour.
chriadam
reviewed
Mar 2, 2026
| enum FormatHint { | ||
| CompactUnitFormat = 0x1 | ||
| CompactUnitFormat = 0x1, | ||
| DecimalsAdjustmentAllowed = 0x4, |
Contributor
There was a problem hiding this comment.
Also, maybe this flag should be DecimalsAdjustmentDisallowed, so that the "default" value can be just zero. I am not sure, though...
chriadam
reviewed
Mar 2, 2026
| Q_INVOKABLE QString formatLongitude(qreal longitude, VenusOS::Enums::GpsData_Format format) const; | ||
|
|
||
| Q_INVOKABLE int defaultUnitPrecision(VenusOS::Enums::Units_Type unit) const; | ||
| Q_INVOKABLE int defaultUnitDecimalPlaces(VenusOS::Enums::Units_Type unit) const; |
Contributor
There was a problem hiding this comment.
Maybe just defaultUnitDecimals() since the property name is decimals not decimalPlaces etc.
chriadam
reviewed
Mar 2, 2026
| bool precisionAdjustmentAllowed = true, | ||
| int decimals = 0, | ||
| qreal unitMatchValue = qQNaN(), | ||
| int formatHints = 0) const; |
Contributor
There was a problem hiding this comment.
can this be VenusOS::Units::FormatHints instead of int?
Contributor
|
Please separate this into two commits, the first doing the renaming from precision to decimals, and the second doing the formatHints stuff. |
5bf6768 to
f1ce8d8
Compare
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.
Move truncating digits after the decimal point to FormatHints mechanism. Also change to decimals nameclature everywhere.
Contributes to #2791