create a table in Qt and fill it by the user
<p>i want to create an Qt application containing a table of 3 columns and n row, the user will choose the number of row by putting it in the edit button and the table will have 3 columns and the number given by the user. then fill it with element</p>

<p>i have search a lot but only found how to fill the able with sql data,</p>

<p>please is anybody having an idea?</p>

<p>here is what i did so far, i have fixed the number of rows and columns but it is not what i want, besides, i want to use either QtableWidget or QtavleViewItem</p>

<pre><code> int n;

        n = ui-&gt;spinBox-&gt;value();
    QStandardItemModel *model = new QStandardItemModel(n,3,this); //2 Rows and 3 Columns
     model-&gt;setHorizontalHeaderItem(0, new QStandardItem(QString("x")));
     model-&gt;setHorizontalHeaderItem(1, new QStandardItem(QString("y")));
     model-&gt;setHorizontalHeaderItem(2, new QStandardItem(QString("z")));


    ui-&gt;tableView-&gt;setModel(model);
</code></pre>