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 @@ class _Canvas(QGraphicsRectItem):
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 @@ class Line(QGraphicsItem):
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 @@ class Line(QGraphicsItem):
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: