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

Shriramana Sharma samjnaa at gmail.com
Thu Nov 15 17:52:32 GMT 2012


Hello. Could anyone please look into the curious behaviour I reported
last month as seen below? (I'll also ask this on the Qt Interest list
as it concerns C++ as well.)

I've included the buggy PyQt program as well as a minimal test of a
slider in C++ and PyQt. I note that in both the C++/PyQt minimal
examples the bug is reproducible only when there is only a slider + a
doubleSpin and not when there is also an integer spin. When there is
an integer spin in addition, there is some lagging behind between the
widgets (as can be seen visually as well as in the debug output) but
it gets through and I'm able to run the whole range using the
keyboard, but if there is no integer spin and only the double spin
with the slider, the problem surfaces. As it is seen also in C++ I
presume it is not a PyQt-only problem, but this is something probably
other PyQt programmers also can face or would have faced. I'd like to
know what to do to fix this.

Thanks!

Shriramana.

On Mon, Oct 1, 2012 at 9:32 AM, Shriramana Sharma <samjnaa at gmail.com> wrote:
> 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



-- 
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/20121115/2c0ca500/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slider-minimal-test.tar.gz
Type: application/x-gzip
Size: 1696 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121115/2c0ca500/attachment-0001.bin>


More information about the PyQt mailing list