Ejemplo n.º 1
10
 def keyPressEvent(self, event): #Override
     keyLeft = 16777234
     keyRight = 16777236
     keyUp = 16777235
     keyDown = 16777237
     keyReturn = 16777220
     if event.key() == Qt.Key_0 or \
        event.key() == Qt.Key_1 or \
        event.key() == Qt.Key_2 or \
        event.key() == Qt.Key_3 or \
        event.key() == Qt.Key_4 or \
        event.key() == Qt.Key_5 or \
        event.key() == Qt.Key_6 or \
        event.key() == Qt.Key_7 or \
        event.key() == Qt.Key_8 or \
        event.key() == Qt.Key_9 or \
        event.key() == Qt.Key_Backspace or \
        event.key() == Qt.LeftArrow or \
        event.key() == Qt.RightArrow or \
        event.key() == Qt.UpArrow or \
        event.key() == Qt.DownArrow or \
        event.key() == Qt.ArrowCursor or \
        event.key() == keyLeft or \
        event.key() == keyRight or \
        event.key() == keyUp or \
        event.key() == keyDown or \
        event.key() == keyReturn or \
        event.key() == Qt.Key_Delete:
         QLineEdit.keyPressEvent(self, event)
     else:
         pass
Ejemplo n.º 2
10
 def keyPressEvent(self, event): #Override
     keyLeft = 16777234
     keyRight = 16777236
     keyUp = 16777235
     keyDown = 16777237
     keyReturn = 16777220
     if event.key() == Qt.Key_Period:
         pass
     else:
         QLineEdit.keyPressEvent(self, event)
Ejemplo n.º 3
10
	def keyPressEvent(self, event):
		if event.key() == Qt.Key_Z:
			if event.modifiers() & Qt.ControlModifier:
				if self.mw.undo_group.activeStack().index() > 0:
					self.mw.view.setFocus()	  # this is important so that, if a user made changes while *in* the widget, and then attempted to undo them, those changes will be pushed to the undo stack (this triggers the necessary 
					self.mw.undo_group.undo()
			else:
				QLineEdit.keyPressEvent(self, event)
		elif event.key() == Qt.Key_Y:
			if event.modifiers() & Qt.ControlModifier:
				if self.mw.undo_group.activeStack().index() < self.mw.undo_group.activeStack().count():
					self.mw.view.setFocus()
					self.mw.undo_group.redo()
			else:
				QLineEdit.keyPressEvent(self, event)
		else:
			QLineEdit.keyPressEvent(self, event)
Ejemplo n.º 4
10
	def keyPressEvent(self, event):
		if event.key() == Qt.Key_Delete:
			self.setText("0.00")
		else:
			QLineEdit.keyPressEvent(self, event)