title: Stretching element to contain all children
body: <p>How is it possible in <a href="http://en.wikipedia.org/wiki/QML" rel="noreferrer">QML</a> to automatically stretch element so that all its childs fit in it? And how to specify spacing? For example, I would like to have a rectangle around a text. The rectangle should have some internal spacing.</p>
  
  <p>If I write the following then the rectangle has a size of 0,0.</p>
  
  <pre><code>Rectangle {
      color: "gray"
      anchors.centerIn: parent;
  
      Text {
          text: "Hello"
      }
  }
  </code></pre>
  
  <p>If I try to fix it by using the <code>Column</code> element, as suggested in <em><a href="https://stackoverflow.com/questions/5807557/how-to-make-qml-items-to-grow-to-fit-contents">How to make QML items to grow to fit contents?</a></em>, then I get a column through the whole window/parent,</p>
  
  <pre><code>Column {
      anchors.centerIn: parent
  
      Rectangle {
          color: "gray"
          anchors.fill: parent
      }
  
      Text {
          anchors.centerIn: parent
          text: "Hello"
      }
  }
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I have also tried to use the <code>Flow</code> element instead of <code>Column</code>, but then I got a row through the whole window/parent.</p>