Proper fix for breakage in LRF viewer caused by API change in QGraphicsItem in Qt 4.6

This commit is contained in:
Kovid Goyal 2010-02-13 22:26:07 -07:00
parent a2229b6e51
commit d21f3ffb52
2 changed files with 7 additions and 4 deletions

View file

@ -79,6 +79,8 @@ def __init__(self, font_loader, logger, opts, width=0, height=0, parent=None, x=
pen = QPen()
pen.setStyle(Qt.NoPen)
self.setPen(pen)
if not hasattr(self, 'children'):
self.children = self.childItems
def layout_block(self, block, x, y):
if isinstance(block, TextBlock):

View file

@ -358,6 +358,8 @@ def __init__(self, line_length, offset, linespace, align, hyphenate, block_id):
self.links = collections.deque()
self.current_link = None
self.valign = None
if not hasattr(self, 'children'):
self.children = self.childItems
def start_link(self, refobj, slot):
self.current_link = [self.current_width, sys.maxint, refobj, slot]
@ -481,10 +483,9 @@ def paint(self, painter, option, widget):
painter.restore()
painter.save()
painter.setPen(QPen(Qt.NoPen))
if hasattr(self, 'children'):
for c in self.children():
painter.setBrush(c.brush)
painter.drawRect(c.boundingRect())
for c in self.children():
painter.setBrush(c.brush)
painter.drawRect(c.boundingRect())
painter.restore()
painter.save()
for tok in self.tokens: