Skip to content
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

Add QLineEdit support to UISliderWidget #168

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Conversation

jcornall
Copy link
Collaborator

@jcornall jcornall commented Dec 16, 2024

Closes #125 #60

The current UISliderWidget is limited due to the following factors:

  • Instantiating a UISliderWidget requires a QLabel, which is updated to show the value of the slider
  • The QLabel cannot be updated manually
  • The slider does not support float/double values

This pull request removes the QLabel parameter in favour of a QDoubleSpinBox parameter, which displays the current value of the slider, can be manually edited (supports float/double values), and updates when the slider value is changed.

An example has been included in the /examples/ folder to demonstrate the functionality.

PLEASE NOTE: By default the QSlider.value() only supports integer values - even if the value of the QDoubleSpinBox is a float/double, this value is automatically converted to an integer when the slider value is updated. I am investigating solutions to this problem so that the slider value accurately reflects that of the QDoubleSpinBox.

Current Tasks:

  • Implement QLineEdit
  • Remove hardcoded values
  • Make sure spinbox is linked to slider
  • Overload the init, one with the DSpinBox and one without
  • Add min and max QLabels
  • Consider whether to split the class into two separate classes
  • Add tests for the widget to eqt

@jcornall jcornall added this to the Version x.x.x milestone Dec 16, 2024
@jcornall jcornall requested a review from DanicaSTFC December 16, 2024 16:28
@jcornall jcornall self-assigned this Dec 16, 2024
eqt/ui/UISliderWidget.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@jcornall jcornall changed the title Add QDoubleSpinBox support to UISliderWidget Add QLineEdit support to UISliderWidget Dec 19, 2024
@jcornall
Copy link
Collaborator Author

Updated PR title to reflect changes to the design of the UISliderWidget class.

Following discussions with @paskino and @DanicaSTFC, it was agreed that instead of a QDoubleSpinBox the UISliderWidget class would make better use of a QLineEdit, removing restrictions on the decimal values users can input.

@jcornall
Copy link
Collaborator Author

image

QSlider 1: Modified UISliderWidget, individual widgets passed as arguments to connect them to the QSlider, then added to the FormDialog afterwards.
QSlider 2: New class UISliderLEditWidget, which creates its own widgets and adds them to a layout for display.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UISliderWidget to have a QDoubleSpinBox attached
3 participants