def keyPressEvent(self, event): '''Handle key pressed event. Argument(s): event (QKeyEvent): Key event ''' QGraphicsTextItem.keyPressEvent(self, event) self.parentItem().updateShapeAndEdges()
def textkeyPressEvent(self, event): """ Must intercept invalid input events. Make changes here """ a = event.key() text = event.text() if a in [Qt.Key_Space, Qt.Key_Tab]: return elif a in [Qt.Key_Return, Qt.Key_Enter]: self.inputMethodEventHandler(event) return # elif unicode(text).isalpha(): elif text.isalpha(): return else: return QGraphicsTextItem.keyPressEvent(self._label, event)
def keyPressEvent(self, event: QKeyEvent): """Must intercept invalid input events. Make changes here """ a = event.key() text = event.text() if a in [Qt.Key_Space, Qt.Key_Tab]: return elif a in [Qt.Key_Escape]: self.updateLabel() self.focusOut() return elif a in [Qt.Key_Return, Qt.Key_Enter]: self.inputMethodEvent(event) return elif text.isalpha(): return else: return QGraphicsTextItem.keyPressEvent(self, event)
def keyPressEvent(self, e): QGraphicsTextItem.keyPressEvent(self, e) self.parentItem().update()