Hello guys!

I am a total Qt beginner and I am still struggling a little bit with layouts. My 2 questions:

1) When I create a layout per code I make it like this:
Qt Code:
  1. QHBoxLayout *mainLayout = new QHBoxLayout;
  2. mainLayout->addLayout(leftLayout);
  3. mainLayout->addLayout(rightLayout);
  4. setLayout(mainLayout);
To copy to clipboard, switch view to plain text mode 
I explicitly set the layout of this widget by calling setLayout(). But when I create my Window in the Qt Designer, there isn't a call to setLayout() at all! The only thing I noticed was this:
Qt Code:
  1. verticalLayout = new QVBoxLayout(centralwidget);
  2. verticalLayout = new QVBoxLayout(centralwidget);
To copy to clipboard, switch view to plain text mode 
Does this line mean the centralwidget now has a vertical layout? Or is this just used for resource management (so that the layout is deleted when the centralwidget is deleted)?

2) Lets take the example from question 1: 3 buttons in a horizontal layout. I don't understand why each button has a Horizontal and Vertical Stretch AND the layout itself also has a layoutStretch (0,0,0). How are they related? Does the layoutStretch values of the QHBoxLayout override the horizontal strech values of the contained widgets?

Thanks!