def mousePressEvent(self, event): if self.flag_mouse_event: if event.button() == Qt.LeftButton: calc = self.tree.rootItem.childItems[1].itemData[0][1] calc.border_cam = self calc.choose_border_cam_false() calc.lineEdit_border_cam.setText(self.name) QGraphicsItem.mousePressEvent(self, event)
def __init__(self, line_length, offset, linespace, align, hyphenate, block_id): QGraphicsItem.__init__(self) self.line_length, self.offset, self.line_space = line_length, offset, linespace self.align, self.hyphenate, self.block_id = align, hyphenate, block_id self.tokens = collections.deque() self.current_width = 0 self.length_in_space = 0 self.height, self.descent, self.width = 0, 0, 0 self.links = collections.deque() self.current_link = None self.valign = None if not hasattr(self, 'children'): self.children = self.childItems
def itemChange (self, change,value): if change == QGraphicsItem.ItemSelectedChange : self.heros.setSelected(value,self.view.first_selection) # return super(HerosItem,self).itemChange(change,value) #if (change == QGraphicsItem.ItemPositionChange) and (self.pos().x()!= self.pos().y()) and (self.pos().x()!=0) : #self.heros.attribs['latitude'],self.heros.attribs['longitude'] = self.scene_coord.SceneToLatLon(self.pos().x(),self.pos().y()) #print ('position changed',self.heros.attribs['latitude'],self.heros.attribs['longitude']) return QGraphicsItem.itemChange(self,change,value)
def itemChange(self, change, value): if change == QGraphicsItem.ItemPositionHasChanged : self.model.position = value #pos = self.view.mapToScene(value.x(),value.y()) lat,lon = self.scene_coord.SceneToLatLon(value.x(),value.y()) self.model.changePosition (lat,lon) print ('new position ',self.model.position) else: return QGraphicsItem.itemChange(self,change,value)
def hoverLeaveEvent(self, event): self.setPen(self.last_pen) self.log.notHovered.emit() QGraphicsItem.hoverMoveEvent(self, event)
def hoverEnterEvent(self, event): self.last_pen = self.pen() self.setPen(self.hover_pen) self.log.hovered.emit() QGraphicsItem.hoverMoveEvent(self, event)
def hoverLeaveEvent(self,event): print ('leave event') return QGraphicsItem.hoverLeaveEvent(self,event)
def hoverEnterEvent(self, event): self.showPicture() return QGraphicsItem.hoverEnterEvent(self,event)