Replace a widget in Qt
<p>I have a base class which has some gui items that i have set positions of using the designer in Qt creator. Those items are:</p>

<pre><code>QWidget* w1;
QWidget* w2;
QWidget* w3;
</code></pre>

<p>Now in a class that inherits that base class, I would like to "transform" those widgets into lineEdit items, that would keep all the geometrical parameters of that widgets. So I do something like this:</p>

<pre><code>QLineEdit* leAmplitude;
leAmplitude = new QLineEdit(ui-&gt;w1);
leAmplitude-&gt;setGeometry(ui-&gt;w1-&gt;geometry());
ui-&gt;glControls-&gt;addWidget(leAmplitude);
</code></pre>

<p>But the added <code>QLineEdit</code> item doesn't appear in the exact same place as w1 item. Its just added at the bottom of other controls in the <code>QGridLayout</code> glControls. How to make the lineEdit to take all geometric parameters from w1?</p>