title: disable editing and setItem to several rows in QTableWidget
body: <p><code>|   Name   |  Math  |  Physics  |  Average grade  |</code><br>
  <code>|          |        |           |                 |</code><br>
  <code>|          |        |           |                 |</code><br>
  <code>|          |        |           |                 |</code><br>
  <code>|          |        |           |                 |</code><br>
  <code>|          |        |           |                 |</code><br>
  <code>|          |        |           |                 |</code>  </p>
  
  <ol>
  <li><p>the column "math" and "physics" is for user to put number in, the column "average" CAN NOT be put value, it is only for showing average value after user put "math" and "physics" grade. How can i disable editing but still show calculated value in column "average" ?</p></li>
  <li><p>I want to write content to several rows, but my code does not work</p>
  
  <pre><code>ui-&gt;tableWidget-&gt;setColumnCount(4);
  ui-&gt;tableWidget-&gt;setRowCount(8);
  ui-&gt;tableWidget-&gt;setSortingEnabled(false);
  QTableWidgetItem *newItem = new QTableWidgetItem(tr("Hello World"));
  for (int i=0; i&lt; ui-&gt;tableWidget-&gt;rowCount(); i++)
      ui-&gt;tableWidget-&gt;setItem(i, 0, newItem);
  </code></pre></li>
  </ol>
  
  <p>There is a message like this</p>
  
  <pre><code>QTableWidget: cannot insert an item that is already owned by another QTableWidget
  </code></pre>
  
  <p>I still don't understand because i am a newbie with QT. Please help me, many thanks ! :)</p>
  
  <p>Code updated:</p>
  
  <pre><code>for (int i = 0; i &lt; ui.tableWidget-&gt;rowCount(); i++) {
      QTableWidgetItem *icon_item = new QTableWidgetItem;
      QIcon icon(":/myproject/icon/test.png");
      icon_item-&gt;setIcon(icon);
      ui.tableWidget-&gt;setItem(i, 0, icon_item);
  }
  
  for (int j = 0; j &lt; ui.tableWidget-&gt;rowCount(); j++) {
      ui.tableWidget-&gt;item(j, 3)-&gt;setFlags(ui.tableWidget-&gt;item(j, 3)-&gt;flags() &amp; ~Qt::ItemIsEditable);
  }
  </code></pre>