tags:

views:

80

answers:

0

Hi,

I have QTableView with checkbox, but the checkbox is aligned left I need to align it center
I try this: http://qt.nokia.com/developer/faqs/faq.2008-01-03.2614755816
But have problem with check function

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)

What is check function? How can I reimplement c++ sample to python?