Results 1 to 9 of 9

Thread: Child widget does not move along with its parent

  1. #1

    Question Child widget does not move along with its parent

    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

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Child widget does not move along with its parent

    you mean to say your subwindow did not moved with mainwindow or you are talking about resizing?

  3. #3

    Default Re: Child widget does not move along with its parent

    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

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Child widget does not move along with its parent

    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?

  5. #5

    Default Re: Child widget does not move along with its parent

    Yes, you are right.

  6. #6
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Child widget does not move along with its parent

    can you post a screen shot of your application in an error condition (child widget at original position and subwindow at another)

  7. #7

    Default Re: Child widget does not move along with its parent

    alright,
    before moving the child window:


    after moving the child window:

  8. #8
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Child widget does not move along with its parent

    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?

  9. #9

    Default Re: Child widget does not move along with its parent

    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.

Similar Threads

  1. How to Create child widget behind parent widget?
    By anupamgee in forum Qt Programming
    Replies: 6
    Last Post: 22nd June 2010, 13:03
  2. How to move child widget with parent widget?
    By anupamgee in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 15:23
  3. let parent widget grow with child widget?
    By BeS in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 11:17
  4. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  5. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.