title: How to align the text to center of cells in a QTableWidget
body: <p>I am using PyQt based on Qt4. My Editor is PyCharm 2017.3 and my python version is 3.4. I am scraping some text from a website. I am trying to align that text to the center of the cell in a QTableWidget.</p>
  
  <pre><code>item = QTableWidgetItem(scraped_age).setTextAlignment(Qt.AlignHCenter)
  self.tableWidget.setItem(x, 2,item)
  </code></pre>
  
  <p>Therefore while putting the item in the cell, I am trying to align it as per the <a href="http://pyqt.sourceforge.net/Docs/PyQt4/qtablewidgetitem.html#setTextAlignment" rel="noreferrer">documentation</a>. The problem is that the data is not showing up.</p>
  
  <p><a href="https://i.stack.imgur.com/Y0isO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Y0isO.png" alt="a part of QtableWidget where data is not showing up"></a><br></p>
  
  <p>It did show up when I removed setTextAlignment method as shown below<br></p>
  
  <pre><code>item = QTableWidgetItem(scraped_age)
  self.tableWidget.setItem(x, 2,item)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/QAuBh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QAuBh.png" alt="a part of my QtableWidget"></a></p>