title: Qt remove Layout from other Layout
body: <p><a href="https://i.stack.imgur.com/LMKgJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LMKgJ.png" alt="When I use delete layout_newInfo; layout_main-&gt;update() happends this."></a>How can I remove an layout_newInfo from layout_main in runtime (pressing button)?</p>
  
  <p><a href="https://i.stack.imgur.com/fIYh5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fIYh5.png" alt="I need get this back after pressing button (next image)"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ELtT1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ELtT1.png" alt="Delete orange section (layout_newInfo) by pressing button Add Component"></a></p>
  
  <p>code I tried:</p>
  
  <pre><code>    QLayout *layout = this-&gt;layout();
  
      QLayoutItem *item;
      while ((item = layout-&gt;takeAt(0)) != 0)
          layout-&gt;removeItem (item);
      delete layout_newInfo;
      layout_main-&gt;update();
  </code></pre>