1 | /* |
2 | SPDX-FileCopyrightText: 2021 Antonio Prcela <antonio.prcela@gmail.com> |
3 | |
4 | SPDX-License-Identifier: GPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef KCALC_HISTORY_H_ |
8 | #define KCALC_HISTORY_H_ |
9 | |
10 | #include <QTextEdit> |
11 | |
12 | #include "kcalc_core.h" |
13 | |
14 | /* |
15 | This class provides a history display. |
16 | */ |
17 | |
18 | class KCalcHistory : public QTextEdit |
19 | { |
20 | Q_OBJECT |
21 | |
22 | public: |
23 | explicit KCalcHistory(QWidget *parent = nullptr); |
24 | ~KCalcHistory() override; |
25 | |
26 | void addToHistory(const QString &, bool); |
27 | void addResultToHistory(const QString &); |
28 | void addFuncToHistory(const CalcEngine::Operation); |
29 | void addFuncToHistory(const QString &); |
30 | |
31 | void changeSettings(); |
32 | void setFont(const QFont &font); |
33 | const QFont &baseFont() const; |
34 | |
35 | public Q_SLOTS: |
36 | void clearHistory(); |
37 | |
38 | protected: |
39 | void resizeEvent(QResizeEvent* event) override; |
40 | |
41 | private: |
42 | bool add_new_line_ = false; |
43 | QFont baseFont_; |
44 | double idealPointSizeF_; |
45 | void updateFont(double zoomFactor = 1.0); |
46 | }; |
47 | |
48 | #endif |
49 | |