-
Notifications
You must be signed in to change notification settings - Fork 170
Menu spinbox bug fixes #2032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Menu spinbox bug fixes #2032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses several issues with the MenuSpinbox widget to ensure that the spinbox behaves correctly when handling user inputs, value adjustments, and edge cases for scaling.
- Fixes incorrect value adjustments when incrementing from or decrementing to zero.
- Implements scale-aware decrement logic and improved input reset behavior.
- Updates widget population and clamps values to enable/disable buttons appropriately.
f9bd375
to
b1204a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes several bugs in the MenuSpinbox widget related to user input handling, scaling behavior, and floating point imprecision.
- Improved initialization order in the constructor and corrected member assignation.
- Adjusted plus/minus button logic to correctly handle zero‐value cases and scale transitions.
- Added rounding in increment strategies and updated clamp logic to disable buttons at min/max boundaries.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
gui/src/widgets/menuspinbox.cpp | Updated widget logic to handle edge cases for scaling and input reset; improved clamp behavior to disable buttons at limits. |
gui/include/gui/widgets/menuspinbox.h | Added a helper rounding function and updated arithmetic operations to reduce floating point imprecision. |
Comments suppressed due to low confidence (1)
gui/src/widgets/menuspinbox.cpp:376
- [nitpick] Verify that the revised threshold for selecting the scale (changed from '>= 10' to '>= 1') aligns with the intended user experience, as this significantly alters scaling behavior.
if(absvalue / scale >= 1)
d1342d0
to
b1204a2
Compare
Signed-off-by: IonutMuthi <[email protected]>
…e even for value 0 Signed-off-by: IonutMuthi <[email protected]>
…eached Signed-off-by: IonutMuthi <[email protected]>
b1204a2
to
11597c2
Compare
This PR fixes the following issues
When a wrong value or a random string is used as user input doesn't reset to previous value
Using +/- to change value is not considering scale bug reproduced by clicking + when value is 0 is increased with 1 of but for the next lowest available scale
Scale down is done from value 1 not 10 if value would reach 0 but it has a lower scale the value will reach 999 of lower scale
When min and max values are reach the - and + buttons are disabled