Results 1 to 4 of 4

Thread: How to move child widget with parent widget?

  1. #1
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to move child widget with parent widget?

    hi All,
    I want to move my child widget on move of parent widget.I have tried move() child in moveEvent of parent. But movement of child is Delayed by parent's movement.
    Qt Code:
    1. void parent::moveEvent(QMouseMoveEvent *event)
    2. {
    3. child->move(event->pos().x()-oldpos.x,event->pos().y()-oldpos.y);
    4. }
    To copy to clipboard, switch view to plain text mode 

    How to move both the widget simultaneously.
    thnx

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to move child widget with parent widget?

    Sounds like the child is not actually a child in QWidget terms, but just another window, is that right?
    J-P Nurmi

  3. #3
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to move child widget with parent widget?

    yes,child is a separate window.how to move them simultaneously?

  4. #4
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to move child widget with parent widget?

    I have the same thing in the parent widget and the child moves along with it simultaneously.

    I actually edited the eventFilter in dragmovecharm to call a function in the childwindow to "adjust" accordingly.

    Regards,
    Pembar

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. Replies: 7
    Last Post: 14th May 2009, 01:37
  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.