title: How to remove more than one rows from layout?
body: <p>I add widgets to layout and then add this layout as a row to another layout:</p>
  
  <pre><code>lbl = new QLabel(this);
      currentResistorText += tr("Resistor") + tr("#") + QString::number(resistorCounter);
      lbl-&gt;setText(currentResistorText);
  
      newResistorLayout = new QHBoxLayout();
  
      lineEdit = new QLineEdit(this);
  
      newResistorLayout-&gt;addWidget(lbl);
      newResistorLayout-&gt;addWidget(lineEdit);
  
      ui-&gt;resistorsLayout-&gt;insertRow(fieldCounter, newResistorLayout);
  </code></pre>
  
  <p>I do it in slot, so there can be added multiple rows.</p>
  
  <p>When I try to remove one row it works.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>ui-&gt;resistorsLayout-&gt;takeRow(ui-&gt;resistorLayout-&gt;rowCount() - 1);
  
      delete lbl;
      delete lineEdit;
      delete newResistorLayout;
  </code></pre>
  
  <p>If I try to remove the second row then program just crashes. I also tried to use the removeRow() method, but result was the same. What am I doing wrong?  And how can I remove more than one row?<br>
  I'm using Qt 5.8.</p>