eric6/Graphics/AssociationItem.py

changeset 7529
2b8a0d8ba12a
parent 7360
9190402e4505
child 7780
41420f82c0ac
equal deleted inserted replaced
7528:0345f54d3959 7529:2b8a0d8ba12a
39 39
40 The association is drawn as an arrow starting at the first items and 40 The association is drawn as an arrow starting at the first items and
41 ending at the second. 41 ending at the second.
42 """ 42 """
43 def __init__(self, itemA, itemB, assocType=Normal, topToBottom=False, 43 def __init__(self, itemA, itemB, assocType=Normal, topToBottom=False,
44 parent=None): 44 colors=None, parent=None):
45 """ 45 """
46 Constructor 46 Constructor
47 47
48 @param itemA first widget of the association 48 @param itemA first widget of the association
49 @param itemB second widget of the association 49 @param itemB second widget of the association
51 <ul> 51 <ul>
52 <li>Normal (default)</li> 52 <li>Normal (default)</li>
53 <li>Generalisation</li> 53 <li>Generalisation</li>
54 <li>Imports</li> 54 <li>Imports</li>
55 </ul> 55 </ul>
56 @keyparam topToBottom flag indicating to draw the association 56 @param topToBottom flag indicating to draw the association
57 from item A top to item B bottom (boolean) 57 from item A top to item B bottom
58 @keyparam parent reference to the parent object (QGraphicsItem) 58 @type bool
59 @param colors tuple containing the foreground and background colors
60 @type tuple of (QColor, QColor)
61 @param parent reference to the parent object
62 @type QGraphicsItem
59 """ 63 """
60 if assocType == Normal: 64 if assocType == Normal:
61 arrowType = NormalArrow 65 arrowType = NormalArrow
62 arrowFilled = True 66 arrowFilled = True
63 elif assocType == Imports: 67 elif assocType == Imports:
66 elif assocType == Generalisation: 70 elif assocType == Generalisation:
67 arrowType = WideArrow 71 arrowType = WideArrow
68 arrowFilled = False 72 arrowFilled = False
69 73
70 E5ArrowItem.__init__(self, QPointF(0, 0), QPointF(100, 100), 74 E5ArrowItem.__init__(self, QPointF(0, 0), QPointF(100, 100),
71 arrowFilled, arrowType, parent) 75 arrowFilled, arrowType, colors, parent)
72 76
73 self.setFlag(QGraphicsItem.ItemIsMovable, False) 77 self.setFlag(QGraphicsItem.ItemIsMovable, False)
74 self.setFlag(QGraphicsItem.ItemIsSelectable, False) 78 self.setFlag(QGraphicsItem.ItemIsSelectable, False)
75 79
76 if topToBottom: 80 if topToBottom:

eric ide

mercurial