Results 1 to 4 of 4

Thread: Parent-child realtionship

  1. #1
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Parent-child realtionship

    How does anyone know how to create parent-child relationship between two QWiget windows in Qt4.?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Parent-child realtionship

    Qt Code:
    1. QWidget *w1 = new QWidget(0);
    2. QWidget *w2 = new QWidget(w1);
    To copy to clipboard, switch view to plain text mode 
    ? Now w2 is child of w1.

  3. #3
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Parent-child realtionship

    But in case if i am using Qt designer and say i created two QWiget classes :


    Class Oneublic QWidget
    {
    };

    Class Twoublic QWidget
    {
    };

    I such type of implementation how to create paren-child relationship?

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Parent-child realtionship

    Don't understand your case, but in designer you only can create parent child relation if the parent is a container. But in that I'm not sure. Either after you called setupUi() you can create some relation using QWidget::setParent().

    And the designer is not an appropriate way to do such things...

Similar Threads

  1. How to move child widget with parent widget?
    By anupamgee in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 15:23
  2. connecting child to parent window...
    By sumit in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2008, 21:28
  3. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  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.