How to call defined slots from keypress event in qt / How to connect keypressed event with QPushbutton on gui?
问题 I am beginner to qt. I was working on calculator gui application, I have already defined slots like numPressed() when any of the number pushbutton is pressed on the calculator that will be displayed on the lineEdit. void Calculator::numPressed(){ QPushButton *button = (QPushButton *)sender(); QString buttonValue = button->text(); Qstring display = ui->lineEdit->text(); Qdouble ProcessedValue = previousValue + buttonValue.toDouble(); . . . ui->lineEdit->setText(QString::number(ProcessedValue))