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

RangeSlider handle not clickable when both have the same value #150

Open
bryandesser opened this issue Mar 10, 2023 · 1 comment
Open

RangeSlider handle not clickable when both have the same value #150

bryandesser opened this issue Mar 10, 2023 · 1 comment

Comments

@bryandesser
Copy link

Describe the bug
When both handles of a QRangeSlider have the same value, i.e. slider.value() = (10,10), the clickable handle is the lower of the two handles (_pressedIndex = 0). When they both take the value of 0, i.e. slider.value() = (0,0), this makes it impossible to click and drag the handles. They can still be moved by either clicking in the slider, which will move the upper handle by pageStep, or scrolling, which moves both (and tends to add some distance between them, which seems like a separate bug).

To Reproduce
Steps to reproduce the behavior:

  1. Run rangeSliderTest.py
  2. Scroll within the bottom left range slider (styled_range_hslider) such that the whole range moves to the farthest left point (styled_range_hslider.value()[0] = 0)
  3. Drag the upper handle as far left as possible, such that it overlaps the lower handle. It seems to be a feature that the two handles will not take the same value. This results in styled_range_hslider.value() = (0,1). Though, in custom apps this is not necessarily true when the handles can be moved programatically or through interaction with a QSPinBox, for example.
  4. Try to click+drag the upper handle to expand the range and nothing happens because self.sender()._pressedIndex = 0
  5. This behaviour can also be reproduced with the multi_range_hslider.

Expected behavior
In the instance where both handles overlap at an arbitrary position, this behaviour is fine; however, when the upper handle size is large enough to overlap the lower handle and slider.minimum(), the default _pressedIndex should give preference to the upper handle.

Screenshots
N/A

Desktop (please complete the following information):

  • Windows 10 Enterprise 21H2
  • PyQt5 v5.15.9
  • Python v3.10.4
@tlambert03
Copy link
Member

thanks for reporting this @bryandesser. I can reproduce it and I see what you mean.

until it gets fixed, I wanted to note that in that situation, you can "grab" the upper handle by clicking anywhere to the right of it (see movie, where clicking on the handle itself displays what you showed... but clicking to the right works fine):

Screen.Recording.2023-04-20.at.8.37.46.PM.mov

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

No branches or pull requests

2 participants