25class Gui :
public QMainWindow
30 explicit Gui(QWidget *parent =
nullptr);
Main window class for the calculator GUI.
void on_btn_plus_clicked()
Operation button handlers.
bool hasOperator() const
Checks if the expression already contains a binary operator.
void on_btn_clear_clicked()
Control buttons.
void updateDisplay()
Updates the calculator display.
QString currentExpression
int findOperatorPos(QChar op) const
Finds the position of the binary operator in the expression.
~Gui()
Destructor. Frees allocated resources.
bool endsWithOperator() const
Helpers for input validation.
void on_btn_div_clicked()
void appendOperator(const QString &op)
Appends a binary operator to the expression.
void on_btn_mul_clicked()
void on_btn_mod_clicked()
Gui(QWidget *parent=nullptr)
Constructs the GUI and initializes components.
void on_btn_root_clicked()
Appends square root operator.
void appendDigit(const QString &digit)
Appends a digit to the expression.
void on_btn_minus_clicked()
void on_btn_pow_clicked()
void on_btn_0_clicked()
Digit button handlers.
void on_btn_dot_clicked()
Appends a decimal point to the current expression.
void keyPressEvent(QKeyEvent *event) override
Keyboard input handler.
void showError(mathlib::MathError err)
Displays an error message based on mathlib error code.
void on_btn_equal_clicked()
Evaluates the current expression.
void on_btn_fac_clicked()
Appends factorial operator.
Mathematical library for calculator project.