90 |
90 |
91 @return bounding rectangle (QRectF) |
91 @return bounding rectangle (QRectF) |
92 """ |
92 """ |
93 extra = self._halfLength / 2.0 |
93 extra = self._halfLength / 2.0 |
94 return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(), |
94 return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(), |
95 self._end.y() - self._origin.y()))\ |
95 self._end.y() - self._origin.y()) |
96 .normalized()\ |
96 ).normalized().adjusted(-extra, -extra, extra, extra) |
97 .adjusted(-extra, -extra, extra, extra) |
|
98 |
97 |
99 def paint(self, painter, option, widget=None): |
98 def paint(self, painter, option, widget=None): |
100 """ |
99 """ |
101 Public method to paint the item in local coordinates. |
100 Public method to paint the item in local coordinates. |
102 |
101 |
103 @param painter reference to the painter object (QPainter) |
102 @param painter reference to the painter object (QPainter) |
104 @param option style options (QStyleOptionGraphicsItem) |
103 @param option style options (QStyleOptionGraphicsItem) |
105 @param widget optional reference to the widget painted on (QWidget) |
104 @param widget optional reference to the widget painted on (QWidget) |
106 """ |
105 """ |
107 if (option.state & QStyle.State_Selected) == \ |
106 if ( |
108 QStyle.State(QStyle.State_Selected): |
107 (option.state & QStyle.State_Selected) == |
|
108 QStyle.State(QStyle.State_Selected) |
|
109 ): |
109 width = 2 |
110 width = 2 |
110 else: |
111 else: |
111 width = 1 |
112 width = 1 |
112 |
113 |
113 # draw the line first |
114 # draw the line first |