개정판 11304552
add text mouse move
Change-Id: I964cd672e58f988a6a6a1386438f85e092a94d63
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py | ||
---|---|---|
61 | 61 |
self.size = None |
62 | 62 |
self.angle = 0 # angle in radian |
63 | 63 |
self._owner = None |
64 |
self.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable) |
|
64 |
self.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable | QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemSendsGeometryChanges) |
|
65 |
#self.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable | QGraphicsItem.ItemIsMovable) |
|
65 | 66 |
self.setAcceptHoverEvents(True) |
66 | 67 |
self.setAcceptTouchEvents(True) |
67 | 68 |
|
... | ... | |
312 | 313 |
|
313 | 314 |
# QGraphicsTextItem.keyPressEvent(self, event) |
314 | 315 |
|
316 |
def mouseMoveEvent(self, event): |
|
317 |
super().mouseMoveEvent(event) |
|
318 |
|
|
319 |
def itemChange(self, change, value): |
|
320 |
""" call signals when item's position or rotation is changed """ |
|
321 |
if not self.scene(): return super().itemChange(change, value) |
|
322 |
|
|
323 |
if change == QGraphicsItem.ItemPositionHasChanged: |
|
324 |
|
|
325 |
scene_origin = self.sceneBoundingRect() |
|
326 |
self.loc = [round(scene_origin.x(), 1), round(scene_origin.y(), 1)] |
|
327 |
|
|
328 |
if hasattr(self.scene(), 'contents_changed'): |
|
329 |
self.scene().contents_changed.emit() |
|
330 |
|
|
331 |
return value |
|
332 |
|
|
333 |
return super().itemChange(change, value) |
|
334 |
|
|
315 | 335 |
''' |
316 | 336 |
@brief draw rect when item is selected |
317 | 337 |
@author humkyung |
318 | 338 |
@date 2018.07.08 |
319 | 339 |
''' |
320 |
|
|
321 | 340 |
def drawFocusRect(self, painter): |
322 | 341 |
if not hasattr(self, '_focus_pen'): |
323 | 342 |
self._focus_pen = QPen(Qt.DotLine) |
내보내기 Unified diff