title: qt treewidget widget item QCheckBox alignment
body: <p>I have a <code>QTreeWidget</code> where I insert different widgets (<code>QDoubleSpinBox</code>,<code>QSpinBox</code>,<code>QCheckBox</code>...) </p>
  
  <pre><code>QTreeWidget *t = ui-&gt;treeWidget;
  QTreeWidgetItem *item = new QTreeWidgetItem();
  
  int c = 0;
  QDoubleSpinBox *dspb = new QDoubleSpinBox();
  t-&gt;setItemWidget(item, c++, dspb);
  
  QSpinBox *spb = new QSpinBox();
  t-&gt;setItemWidget(item, c++, spb);
  
  QCheckBox *cb = new QCheckBox();
  t-&gt;setItemWidget(item, c++, cb);
  
  t-&gt;addTopLevelItem(item);
  </code></pre>
  
  <p>However, the <code>cb</code> widget looks wired since the checkbox is aligned to the left. I would like to see it aligned in the center. </p>
  
  <p><strong>Q: How can I change the checkbox to appear in the middle of the TreeWidget cell?</strong> </p>
  
  <p>I need to be able to access the <code>cb</code> item again later. Currently, I use the following code: </p>
  
  <pre><code>QTreeWidgetItem *itm = t-&gt;topLevelItem(0);
  bool checked  = qobject_cast&lt;QCheckBox *&gt;(t-&gt;itemWidget(itm,c++))-&gt;checkState() == Qt::Checked;
  </code></pre>
  
  <p>If I need to do some workaround to get the central alignment going, how can I access the <code>cb</code> object then? </p>