Пример #1
0
gboolean
on_entry1_key_press_event              (GtkWidget       *widget,
                                        GdkEventKey     *event,
                                        gpointer         user_data)
{
	if(event->hardware_keycode==36)
		on_button3_clicked(NULL,NULL);
  return FALSE;
}
Пример #2
0
void MainWindow::keyPressEvent(QKeyEvent *key) {
    switch (key->key()) {
    case Qt::Key_Return:
        on_buttonEquals_clicked();
        break;
    case Qt::Key_0:
        on_button0_clicked();
        break;
    case Qt::Key_1:
        on_button1_clicked();
        break;
    case Qt::Key_2:
        on_button2_clicked();
        break;
    case Qt::Key_3:
        on_button3_clicked();
        break;
    case Qt::Key_4:
        on_button4_clicked();
        break;
    case Qt::Key_5:
        on_button5_clicked();
        break;
    case Qt::Key_6:
        on_button6_clicked();
        break;
    case Qt::Key_7:
        on_button7_clicked();
        break;
    case Qt::Key_8:
        on_button8_clicked();
        break;
    case Qt::Key_9:
        on_button9_clicked();
        break;
    case Qt::Key_Comma:
        on_buttonDot_clicked();
        break;
    case Qt::Key_Plus:
        on_buttonAdd_clicked();
        break;
    case Qt::Key_Minus:
        on_buttonSubstract_clicked();
        break;
    case Qt::Key_Slash:
        on_buttonDivide_clicked();
        break;
    case Qt::Key_Asterisk:
        on_buttonMultiply_clicked();
        break;
    case Qt::Key_Backspace:
        on_pushButton_clicked();
        break;
    default:
        break;
    }
}