Changing the 'active' widget
I'm trying to solve an interaction problem with Qt, may be someone can give me some
hints... Here's my problem: I have a simple button that, under certain circumstances,
should take control over a scroll bar.
More precisely: when the user presses the button and does not release the mouse button
before a while, I want to show some form where the focus widget should be a scroll bar. Moving
the mouse should now control the scroll bar... The point is to let the user create this form and
start using the scroll immediately without having to release the mouse button, move to the
scroll bar, click again and... move to set its value.
I tried to send Events directly to the scrollbar (Enter, Press, Move). I tried to set the scroll
bar as the active widget. I tried to make sure events were properly dispatched (calling
QApplication::processEvents()).. Nothing works: my scroll bar never reacts to events until I
actually click onto it.
Is there a way that I haven't found in the docs to programmatically force a Widget to become
'active', as if I had triggered a MousePress event? I suspect the parent widgets to all the job of
dispatching the event according to their location, and locate the 'active' widget (the one that
from now on will receive the incoming MouseMove events).
This is probably a bit late and I must admit I have absolutely no idea if this will work, but it may be worth looking at calling "setSliderDown":http://qt-project.org/doc/qt-4.8/qabstractslider.html#sliderDown-prop where you create your slider.