mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
Calculator: Accept more keyboard input (#1207)
Allow user to clear/remove last numeral from input (Esc/Backspace respectively) and type the decimal point.
This commit is contained in:
parent
077ef556a7
commit
b67035c3ac
Notes:
sideshowbarker
2024-07-19 09:27:41 +09:00
Author: https://github.com/ignas-sa Commit: https://github.com/SerenityOS/serenity/commit/b67035c3ac5 Pull-request: https://github.com/SerenityOS/serenity/pull/1207 Reviewed-by: https://github.com/awesomekling
1 changed files with 11 additions and 1 deletions
|
@ -236,6 +236,16 @@ void CalculatorWidget::keydown_event(GUI::KeyEvent& event)
|
|||
} else if (event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9) {
|
||||
m_keypad.type_digit(atoi(event.text().characters()));
|
||||
|
||||
} else if (event.key() == KeyCode::Key_Period) {
|
||||
m_keypad.type_decimal_point();
|
||||
|
||||
} else if (event.key() == KeyCode::Key_Escape) {
|
||||
m_keypad.set_value(0.0);
|
||||
m_calculator.clear_operation();
|
||||
|
||||
} else if (event.key() == KeyCode::Key_Backspace) {
|
||||
m_keypad.type_backspace();
|
||||
|
||||
} else {
|
||||
Calculator::Operation operation;
|
||||
|
||||
|
@ -263,4 +273,4 @@ void CalculatorWidget::keydown_event(GUI::KeyEvent& event)
|
|||
}
|
||||
|
||||
update_display();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue