Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Menu spinbox bug fixes #2032

wants to merge 3 commits into from

Conversation

IonutMuthi
Copy link
Contributor

@IonutMuthi IonutMuthi commented May 20, 2025

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

Copy link

@Copilot Copilot AI left a 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.

@IonutMuthi IonutMuthi force-pushed the menu_spinbox_bug_fixes branch 2 times, most recently from f9bd375 to b1204a2 Compare May 21, 2025 06:44
@IonutMuthi IonutMuthi marked this pull request as ready for review May 23, 2025 12:00
@IonutMuthi IonutMuthi requested a review from Copilot May 23, 2025 12:00
Copy link

@Copilot Copilot AI left a 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)

@IonutMuthi IonutMuthi force-pushed the menu_spinbox_bug_fixes branch from d1342d0 to b1204a2 Compare May 27, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants