-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
kcalc_input_display.h
46 lines (36 loc) · 1010 Bytes
/
kcalc_input_display.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
SPDX-FileCopyrightText: 2023 Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QKeyEvent>
#include <QLineEdit>
#include <QString>
class KCalcInputDisplay : public QLineEdit
{
Q_OBJECT
public:
explicit KCalcInputDisplay(QWidget *parent = nullptr);
~KCalcInputDisplay() override;
void insertToken(const QString &token);
void insertTokenNumeric(const QString &token);
void insertTokenFunction(const QString &token);
public Q_SLOTS:
void reset(bool clearRedoUndo = false);
void setHasResult();
void slotSetOverwrite();
void slotSetHardOverwrite();
void slotClearOverwrite();
void clearHasResult();
void undoCalculation();
void redoCalculation();
Q_SIGNALS:
protected:
void keyPressEvent(QKeyEvent *event) override;
void focusInEvent(QFocusEvent *e) override;
private Q_SLOTS:
private:
bool overwrite_;
bool hard_overwrite_;
bool has_result_;
};