[PyQt] Curious behaviour of slider/spin when controlled by keyboard

Shriramana Sharma samjnaa at gmail.com
Mon Oct 1 05:02:25 BST 2012


Hello. With my work on a simple Cubic Bezier investigation application
in PyQt (attached, obviously under GPL), I ran into a curious
behaviour of the slider/spin (for the time along the curve) when
controlled by the keyboard.

Steps:
1. Let the focus be either on the slider (on the left) or the spin
(below it). (The default slider/spin value is 0.50.)
3. Press up-arrow key to increase the slider/spin value.

Observation:
The value will not increase past 0.56.

Steps:
4. Press down-arrow key to decrease the slider/spin value until 0.30.
5. Press down-arrow once more.

Observation:
The value jumps down from 0.30 to 0.28 even though the precision is set at 0.01.

Step:
6. Press up-arrow.

Observation:
The value will now not rise above 0.28.

Step:
7. Adjust the slider position using the mouse.

Observation:
The value can change to any value in its full range from 0.00 to 1.00.

Step:
8. Adjust the slider using the mouse to go beyond 0.60.
9. Press down-arrow to decrease the value until 0.59.
10. Press down-arrow once more.

Observation:
11. The value jumps down to 0.56.
12. It will no longer go above 0.56 using the keyboard (as before).

Query:
My sliderMoved, spinChanged slots are straightforward, and just
convert the integer slider value to the spin and update the bezier
widget accordingly. In which case, I do not understand what it is I am
doing wrong in my programming. However, I wrote a minimal test where
the behaviour is not seen. Any guidance is appreciated.

Thanks!

-- 
Shriramana Sharma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bezierview.py
Type: text/x-python
Size: 16188 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121001/1d0d28a7/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slider-minimal-test.py
Type: text/x-python
Size: 1679 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121001/1d0d28a7/attachment-0001.py>


More information about the PyQt mailing list