def mousePressEvent(self, event): """ We reimplement this function to store the position of the item when a user issues a mouse press. """ self._position = self.pos() if (event.modifiers() & Qt.ControlModifier): QApplication.setOverrideCursor(QCursor(Qt.SizeAllCursor)) self.setTextInteractionFlags(Qt.NoTextInteraction) return QGraphicsTextItem.mousePressEvent(self, event)
def mousePressEvent(self, event): if self.textInteractionFlags() == Qt.NoTextInteraction: self.setTextInteractionFlags(Qt.TextEditorInteraction) QGraphicsTextItem.mousePressEvent(self, event)