PDA

View Full Version : Move child widget along with the parent widget



sreedhar
14th May 2006, 18:35
Hi,
I have the foll.
QTextEditor editor-- parent widget
QWidget child -- chid of editor (window flag set tosetWindowFlags(Qt::ToolTip));

If i move the scroll bars of editor(parent), i want the child to to be in place where it is created on the editor(parent). So the child should also move to the position where it was created on the parent.

I have several child widgets created at diff. positions of the parent. So i want them to be at the same place where they are created abd move along with the parent.

If possible please provide a sample code.

I will be very much thankful for the sol.

regards,
sree

jpn
14th May 2006, 19:00
Create the child widgets with the textedit's viewport as their parent.


SomeWidget* child = new SomeWidget(textEdit->viewport());


Edit: This works only for a child widget. Qt::ToolTip flag indicates that the widget is a tooltip, which is a top level widget, a window.

sreedhar
15th May 2006, 12:00
thanks a lot