Commit bd389399 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add top_level function to Connections

parent 2f371ac8
...@@ -69,6 +69,11 @@ class Connection(QGraphicsPathItem, object): ...@@ -69,6 +69,11 @@ class Connection(QGraphicsPathItem, object):
''' Compute connection intermediate points - redefine in subclasses ''' ''' Compute connection intermediate points - redefine in subclasses '''
return self._middle_points return self._middle_points
def top_level(self):
''' In case the connection has a text, implement top_level()
as needed by TextInteraction '''
return self.parent
def simple_arrow(self, origin='head', path=None): def simple_arrow(self, origin='head', path=None):
''' Compute the two points of an vertical arrow head ''' ''' Compute the two points of an vertical arrow head '''
if origin == 'head': if origin == 'head':
......
...@@ -386,8 +386,8 @@ class EditableText(QGraphicsTextItem, object): ...@@ -386,8 +386,8 @@ class EditableText(QGraphicsTextItem, object):
def focusInEvent(self, event): def focusInEvent(self, event):
''' When user starts editing text, save previous state for Undo ''' ''' When user starts editing text, save previous state for Undo '''
super(EditableText, self).focusInEvent(event) super(EditableText, self).focusInEvent(event)
# Make the Z-value of items to make sure the # Change the Z-value of items to make sure the
# completer will always be on top of other symbols # completer is always be on top of other symbols
parent = self.parentItem() parent = self.parentItem()
top_level = parent.top_level() top_level = parent.top_level()
top_level.setZValue(top_level.zValue() + 1) top_level.setZValue(top_level.zValue() + 1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment