프로젝트

일반

사용자정보

개정판 11304552

ID11304552f1d6f3df23e0437505cc9cf04d961f2a
상위 d9ea4412
하위 7f7cb942, c290a936

함의성이(가) 일년 이상 전에 추가함

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

클립보드 이미지 추가 (최대 크기: 500 MB)