Results 1 to 3 of 3

Thread: What owns what?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: What owns what?

    1) "Root" QWidget is the widget that don't have a parent at construction if you don't set parameter for parent it is default 0, witch means the widget is a window/used for "parenting" other widgets.

    2) Not sure what you meant. Why you want a simple QWidget in anything else? A QWidget has only basic stuff for containing other widgets (derived from QWidget and implementing some functionality)

    3) I don't know the QGraphicsViewProxy, but basic rule is: if you add a widget to some container it will be auto-parented to that.

    4/5) No, the layout is not really implicated in parent/child relation:
    Qt Code:
    1. QVBoxLayout *lay = new QVBoxLayout(window);
    To copy to clipboard, switch view to plain text mode 
    This means that if you add some widgets to the layout that widgets will become child-widgets of the "window" widget.

    6) I don't know, but why do you want some of that? It is your job to make sure that widgets that "need" each-other will be "alive" in the same time, that is the reason why we need to dynamically allocate widgets on the heap (using pointers and new).
    Last edited by Zlatomir; 11th May 2010 at 10:59.

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.