title: PyQt: change the alignment of checkboxes in a QTableView
body: <p>I have a <code>QTableView</code> with checkbox, but the checkbox is aligned left, and I need to align it center. I tried <a href="https://wiki.qt.io/Qt_project_org_faq#How_can_I_align_the_checkboxes_in_a_view.3F" rel="nofollow noreferrer">this</a>, but I have a problem with the "check" function:</p>
  
  <pre><code>def drawCheck(self, painter, option, rect, state):
      textMargin = QtGui.QApplication.style().pixelMetric(QtGui.QStyle.PM_FocusFrameHMargin) + 1
      checkRect = QtGui.QStyle.alignedRect(option.direction, QtCore.Qt.AlignCenter, 
                   check(option, option.rect, QtCore.Qt.Checked).size(),
                  QtCore.QRect(option.rect.x() + textMargin, option.rect.y(),
                  option.rect.width() - (textMargin * 2), option.rect.height()))                           
      QtGui.QItemDelegate.drawCheck(self, painter, checkRect, state)
  </code></pre>
  
  <p>What is the "check" function? How can I reimplement the C++ example in PyQt?</p>