View Full Version : QWidget movable
Pragya
30th March 2007, 08:25
Hi,
If i have to make QWidget ( child widget ) movable then what i have to do?
vermarajeev
30th March 2007, 08:31
Hi,
If i have to make QWidget ( child widget ) movable then what i have to do?
Please explain more...
Pragya
30th March 2007, 08:32
I want to make child Qwidget to work as Dockable widget that is floatable.
jpn
30th March 2007, 08:38
Make sure it's geometry is not managed by a layout and reimplement corresponding mouse and/or key event handlers (depending on how it is supposed to be movable).
Pseudo for mouse movement:
// member variable
QPoint offset;
mousePressEvent()
{
// offset from top left corner
offset = event->pos();
}
mouseMoveEvent()
{
// move to mouse pos - calculated offset
move(mapToParent(event->pos()) - offset);
}
mouseReleaseEvent()
{
// invalidate offset
offset = QPoint();
}
jpn
30th March 2007, 08:39
I want to make child Qwidget to work as Dockable widget that is floatable.
What do you mean? QDockWidget can be made floating.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.