PDA

View Full Version : Child widget does not move along with its parent



starch
9th July 2009, 10:31
Dear all,

I'm doing a project using Qt MDI, which contains multiple child windows inherited from QMdiSubWindow. I added a child widget (QVTKWidget) to a child window. When I moved the child window, the child widget seemed to stay at its original position w.r.t. the mainframe. What could be the possible reason for that? Thanks a lot.

P.S.:
My OS: Mac OS 10.5.7
Qt version: 4.5.1

nish
9th July 2009, 10:39
you mean to say your subwindow did not moved with mainwindow or you are talking about resizing?

starch
9th July 2009, 10:49
Sorry for the confusion.

* the mainframe is fixed
* I moved the subwindow inside the mainframe
* the content of the subwindow (the child widget) did not move along with the subwindow, it was at the original position

nish
9th July 2009, 10:55
sorry but i did not uderstood well.

1. mainframe is fixed (we will call it QMainWindow from now)
2. the subwindow is QMdiSubWindow?
3. the child widget is added as mdiSubwindow->setWidget(childwidget)?

am i right this time?

starch
9th July 2009, 11:05
Yes, you are right.

nish
9th July 2009, 11:11
can you post a screen shot of your application in an error condition (child widget at original position and subwindow at another)

starch
9th July 2009, 11:24
alright,
before moving the child window:
http://img39.imageshack.us/img39/5053/beforec.png

after moving the child window:
http://img232.imageshack.us/img232/1595/after.png

nish
9th July 2009, 12:09
this is very strange... write a minimal compilable example reproducing the error and post the code here... have you tried the application on linux or windows?

starch
9th July 2009, 12:35
Thanks, MrDeath.

The child widget relies on another library (VTK), unless you have this library, otherwise, you will not be able to build.

It seems that my code is fine with Linux. Moreover, it works with previous version of Qt, version 4.4 if remember correctly. It has the same problem with even earlier version, i.e., 4.3.

I guess either Qt or QVTKWidget caused this problem, but I'm not sure what could be the real cause of it.