Runaway QSlider : it's a Qt bug
Guillaume Laurent
glaurent at telegraph-road.org
Sat Mar 6 23:02:10 GMT 2004
On Wednesday 03 March 2004 22:49, Guillaume Laurent wrote:
>
> We have a strange bug in Rosegarden : a QSlider, when clicked on the ruler
> part to move its cursor one notch, goes mad and suddenly slides all the way
> to the last notch. It's just like instead of a single click you had a bunch
> of quick repeated ones.
Just for the record, I finally traced it down to a Qt bug (still in 3.3.1).
The problem occurrs if, in a slot connected to a QSlider's 'valueChanged()'
signal, you call QEventLoop::processEvents(QEventLoop::ExcludeUserInput,
int).
QSlider::mousePressEvent() arms a timer to keep moving the slider if the mouse
button is kept down. But the valueChanged() signal is emitted from within
mousePressEvent().
So when the slot is called, if what it does takes a long time and
processEvents() is called to maintain the GUI, the timer will go off, and
things will happen as is the button is still down even though it's been
released. QSlider::mouseReleaseEvent() is never called.
I'm sending a copy of this to qt-bugs with a sample reproducing it.
--
Guillaume.
http://www.telegraph-road.org
More information about the kde-core-devel
mailing list