PDA

View Full Version : Help with sliders



Erlendhg
20th July 2007, 17:46
Hi.
I have made my own sliders (without subclassing QAbstractSlider), using QGraphicsView to draw the sliders.

I must have missed something, or done something very wrong, because when I connect the sliders to rotate on the 3D sudoku board in my application, the board rotates just fine, but the sliders does not follow the mouse very well. They sort of "hang" after.

I know it can be hard to help, since I cannot post the code of the sudoku board, but if thought that maybe there could be something in my code that is obviously wrong.

Thanks a lot

Gopala Krishna
20th July 2007, 19:30
I didn't get any sort of hang while trying your code. But the feeling of losing mouse can be because of the following.
QSlider remembers the slider position when the actual sliding begins(mouse press) When the mouse is moved away from geometry of slider, the head position is restored and the sliding continues only when the mouse cursor gets backs to the original mouse press position(it seems it looks for same x or y, not necessarily the exact point).

OTOH your implentation just stops slider from moving and doesn't restore the pos. Therefore the mouse cursor keeps moving away from slider as and when you exceed the geometry.

I might not be 100% right since i haven't looked at QSlider code. That might help you :)

Erlendhg
20th August 2007, 13:02
I did not understand what you meant earlier, but I guess you ran my example on Qt 4.3, while I only had Qt 4.2.2 at that time...

It was not exactly that problem I was trying to describe, but now I need help with that too, because in Qt 4.2.2 the Slider-head would move to the position on the circle nearest the mouse, no matter where the mouse was...

Is it possible to maintain this, even in Qt 4.3:
That no matter where the mouse is (even if it is outside of geometry boundaries), the little dot will be placed on the position nearest the mouse?

What I was trying to explain earlier, was that when the slider is connected to my 3D board (and only then), when I move the little dot on the slider, it does not follow for a second, and then "jumps" right to the position on the circle, nearest the mouse...
It is "un-smooth" :P

wysota
20th August 2007, 14:21
Does the "un-smooth" behaviour remain when the slider is not connected to anything?

Erlendhg
21st August 2007, 17:03
No, it doesn't. That is what annoys me.
The only time it does, is when It is connected to a function that updates the 3D board variables, and then calls updateGL() on it.