File indexing completed on 2022-01-30 18:32:35

0001 /*
0002     SPDX-FileCopyrightText: 2021 Antonio Prcela <antonio.prcela@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KCALC_HISTORY_H_
0008 #define KCALC_HISTORY_H_
0009 
0010 #include <QTextEdit>
0011 
0012 #include "kcalc_core.h"
0013 
0014 /*
0015   This class provides a history display.
0016 */
0017 
0018 class KCalcHistory : public QTextEdit
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit KCalcHistory(QWidget *parent = nullptr);
0024     ~KCalcHistory() override;
0025 
0026     void addToHistory(const QString &, bool);
0027     void addResultToHistory(const QString &);
0028     void addFuncToHistory(const CalcEngine::Operation);
0029     void addFuncToHistory(const QString &);
0030 
0031     void changeSettings();
0032     void setFont(const QFont &font);
0033     const QFont &baseFont() const;
0034 
0035 public Q_SLOTS:
0036     void clearHistory();
0037 
0038 protected:
0039     void resizeEvent(QResizeEvent* event) override;
0040 
0041 private:
0042     bool add_new_line_ = false;
0043     QFont baseFont_;
0044     double idealPointSizeF_;
0045     void updateFont(double zoomFactor = 1.0);
0046 };
0047 
0048 #endif