Calculadora: keyPressEvent do QLineEdit e criando um Signal

This commit is contained in:
Luiz Otávio
2023-03-03 15:40:04 -03:00
parent 599211a542
commit 8afa43dc61
2 changed files with 22 additions and 3 deletions

View File

@@ -59,7 +59,12 @@ class ButtonsGrid(QGridLayout):
self._equation = value
self.info.setText(value)
def vouApagarVocê(self):
print('Signal recebido por "vouApagarVocê" em', type(self).__name__)
def _makeGrid(self):
self.display.eqRequested.connect(self.vouApagarVocê)
for rowNumber, rowData in enumerate(self._gridMask):
for colNumber, buttonText in enumerate(rowData):
button = Button(buttonText)
@@ -81,7 +86,7 @@ class ButtonsGrid(QGridLayout):
if text == 'C':
self._connectButtonClicked(button, self._clear)
if text in 'D':
if text == 'D':
self._connectButtonClicked(button, self.display.backspace)
if text in '+-/*^':
@@ -90,7 +95,7 @@ class ButtonsGrid(QGridLayout):
self._makeSlot(self._operatorClicked, button)
)
if text in '=':
if text == '=':
self._connectButtonClicked(button, self._eq)
def _makeSlot(self, func, *args, **kwargs):