PDA

View Full Version : Avoid moving widgets



desch
8th April 2009, 12:23
Hi everyone,

I try to avoid a widget moving when a user try to move it with the mouse;

simply with clicking the widget on its decorated bar, and trying to drag it, I would like the widget stays at its original position

I have experienced moveEvent, but I get recursive loop which seems to be a normal behavior;

However other events must work, like MousePress, enterEvent, ... just avoiding moving

So not found real solution...

If one of you has a way to do it

Thanks,

David
Qt4.3.1, WinXp

wysota
8th April 2009, 13:02
Moving a window by dragging its decoration is implemented by the window manager not by your application. You can only revert the position back to its original state after a move has occured. Or you can get rid of window decorations by passing appropriate window flags while constructing the widget.

desch
8th April 2009, 13:30
Ok
Thanks for your always good and quick reply

so I imagine I have to implement moveEvent myself, but even if you get oldPos(), how you can go back to the first position without infinite loop?

I tried with "boolean implementation", but I can't catch the good oldPos()

maybe you have a solution or there is already a thread which mentioned this?

Thanks you

David

wysota
8th April 2009, 14:42
so I imagine I have to implement moveEvent myself, but even if you get oldPos(), how you can go back to the first position without infinite loop?
Don't do anything if the position already is set to the coordinates you want it to be. In other words only call move() when you want to change the position of the widget, not during every move event.

aamer4yu
8th April 2009, 19:14
You can also consider to use frameless window hint for your window. You wont be able to move it. Also you wont have the title bar.

spirit
9th April 2009, 06:27
You can also consider to use frameless window hint for your window. You wont be able to move it. Also you wont have the title bar.

wysota already said about this in post #2


...Or you can get rid of window decorations by passing appropriate window flags while constructing the widget.
;)