I want to draw grid lines for only some boxes in my QTableView. For this I have implemented a delegate that draws the lines. This all works however when I draw the lines they are thick and black. How do I get a hold of the default settings for the grid lines from my view that way I can make it look like all my other QTableview grid lines? My code is below.
class setup_delegate(QtGui.QStyledItemDelegate):
def __init__(self, parent=None):
super(setup_delegate, self).__init__(parent)
def paint(self, painter, option, index):
if index.data().toBool() or index.row() == 0:
painter.save()
painter.drawRect(option.rect)
painter.restore()
QtGui.QStyledItemDelegate.paint(self, painter, option, index)
class setup_delegate(QtGui.QStyledItemDelegate):
def __init__(self, parent=None):
super(setup_delegate, self).__init__(parent)
def paint(self, painter, option, index):
if index.data().toBool() or index.row() == 0:
painter.save()
painter.drawRect(option.rect)
painter.restore()
QtGui.QStyledItemDelegate.paint(self, painter, option, index)
To copy to clipboard, switch view to plain text mode
Bookmarks