MCPcopy Create free account
hub / github.com/PJLab-ADG/OASim / myQGraphicsPolygonItem

Class myQGraphicsPolygonItem

hmi/routeEdit/gui.py:97–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97class myQGraphicsPolygonItem(QGraphicsPolygonItem):
98 def __init__(self, polygon):
99 super().__init__(polygon)
100
101 def paint(self, painter: QPainter, option: QStyleOptionGraphicsItem, widget):
102 painter.setPen(self.pen())
103 painter.setBrush(self.brush())
104 # if option.state & QStyle.StateFlag.State_Selected:
105 # global CHOOSE_STATE
106 # if CHOOSE_STATE == chooseType.Normal:
107 # painter.setBrush(QColor(255, 255, 0, 50))
108 painter.drawPolygon(self.polygon())
109
110 def mousePressEvent(self, event):
111 if CHOOSE_STATE == chooseType.Start:
112 global START_LANE, LAST_START_LANE
113 LAST_START_LANE = START_LANE
114 START_LANE = self.data(0)
115 elif CHOOSE_STATE == chooseType.Arrival:
116 global ARRIVAL_LANE, LAST_ARRIVAL_LANE
117 LAST_ARRIVAL_LANE = ARRIVAL_LANE
118 ARRIVAL_LANE = self.data(0)
119 self.scene().itemClicked.emit(self)
120
121
122class myQGraphicsScene(QGraphicsScene):

Callers 1

drawPolygonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected