示例#1
0
 def paint(self, painter, option, index):
     """paint right aligned checkbox"""
     viewItemOption = QStyleOptionViewItem(option)
     if self.cellFilter(index):
         textMargin = self.__textMargin()
         newRect = QStyle.alignedRect(
             option.direction, Qt.AlignRight,
             QSize(option.decorationSize.width() + 5,
                   option.decorationSize.height()),
             QRect(option.rect.x() + textMargin, option.rect.y(),
                   option.rect.width() - (2 * textMargin),
                   option.rect.height()))
         viewItemOption.rect = newRect
     QStyledItemDelegate.paint(self, painter, viewItemOption, index)
示例#2
0
 def paint(self, painter, option, index):
     """where the real work is done..."""
     item = index.internalPointer()
     if isinstance(item, ScorePlayerItem) and item.parent.row() == 3 and index.column() != 0:
         for idx, playerItem in enumerate(index.parent().internalPointer().children):
             chart = index.model().chart(option.rect, index, playerItem)
             if chart:
                 with Painter(painter):
                     painter.translate(option.rect.topLeft())
                     painter.setPen(self.colors[idx])
                     painter.setRenderHint(QPainter.Antialiasing)
                     # if we want to use a pen width > 1, we can no longer directly drawPolyline
                     # separately per cell beause the lines spread vertically over two rows: We would
                     # have to draw the lines into one big pixmap and copy
                     # from the into the cells
                     painter.drawPolyline(*chart)
         return
     return QStyledItemDelegate.paint(self, painter, option, index)
示例#3
0
 def paint(self, painter, option, index):
     """where the real work is done..."""
     item = index.internalPointer()
     if isinstance(item, ScorePlayerItem) and item.parent.row(
     ) == 3 and index.column() != 0:
         for idx, playerItem in enumerate(
                 index.parent().internalPointer().children):
             chart = index.model().chart(option.rect, index, playerItem)
             if chart:
                 with Painter(painter):
                     painter.translate(option.rect.topLeft())
                     painter.setPen(self.colors[idx])
                     painter.setRenderHint(QPainter.Antialiasing)
                     # if we want to use a pen width > 1, we can no longer directly drawPolyline
                     # separately per cell beause the lines spread vertically over two rows: We would
                     # have to draw the lines into one big pixmap and copy
                     # from the into the cells
                     painter.drawPolyline(*chart)
         return
     return QStyledItemDelegate.paint(self, painter, option, index)
示例#4
0
 def __init__(self, parent=None):
     QStyledItemDelegate.__init__(self, parent)
示例#5
0
 def __init__(self, parent=None):
     QStyledItemDelegate.__init__(self, parent)