[Interest] Glueing widgets together

Sensei senseiwa at gmail.com
Fri Jun 28 14:56:33 CEST 2013

On 6/28/13 10:53 AM, Richard Moore wrote:
> On 28 June 2013 08:28, Bo Thorsen <bthorsen at ics.com> wrote:
>>> I need to "glue together" two widgets, so that when one moves, the other
>>> *simultaneously* moves.
>>> They should appear glued even when dragging around, fast and slow. Like
>>> if the "follower" is simply painted over the moving widget.
>>> The proposed solutions involve getting the mouse move events dealt with.
>>> This resulted in a visible delay, and that isn't what I want: I don't
>>> want to see the window moving with the follower staying still, and after
>>> few instants, the follower (disappearing from where it was) painted in
>>> the right position.
>>> Is there any way I can achieve this visual effect?
> When you 'glue' them together, reparent both of them into a container
> QWidget. Then when you move them around, you simply move the
> container.

Well, I don't know if that is feasible. The whole hierarchy is this:

          QWidget <------- My custom widget
             QWidget <---- The floating window

So I'd like the floating widget to follow the QToolButton where it 
moves. The button will move *only* if the QMainWindow moves, obviously.

Do you think I can "hack" this by some sort of ubermagic reparenting? How?


More information about the Interest mailing list