Calculadora: adicionando ações nas teclas C, D e sinal de igual
This commit is contained in:
@@ -27,17 +27,18 @@ class Display(QLineEdit):
|
|||||||
key = event.key()
|
key = event.key()
|
||||||
KEYS = Qt.Key
|
KEYS = Qt.Key
|
||||||
|
|
||||||
isEnter = key in [KEYS.Key_Enter, KEYS.Key_Return]
|
isEnter = key in [KEYS.Key_Enter, KEYS.Key_Return, KEYS.Key_Equal]
|
||||||
isDelete = key in [KEYS.Key_Backspace, KEYS.Key_Delete]
|
isDelete = key in [KEYS.Key_Backspace, KEYS.Key_Delete, KEYS.Key_D]
|
||||||
isEsc = key in [KEYS.Key_Escape]
|
isEsc = key in [KEYS.Key_Escape, KEYS.Key_C]
|
||||||
|
|
||||||
if isEnter:
|
if isEnter:
|
||||||
print('Enter pressionado, sinal emitido', type(self).__name__)
|
print(f'EQ {text} pressionado, sinal emitido', type(self).__name__)
|
||||||
self.eqPressed.emit()
|
self.eqPressed.emit()
|
||||||
return event.ignore()
|
return event.ignore()
|
||||||
|
|
||||||
if isDelete:
|
if isDelete:
|
||||||
print('isDelete pressionado, sinal emitido', type(self).__name__)
|
print(f'isDelete {text} pressionado, sinal emitido',
|
||||||
|
type(self).__name__)
|
||||||
self.delPressed.emit()
|
self.delPressed.emit()
|
||||||
return event.ignore()
|
return event.ignore()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user