File indexing completed on 2024-04-14 05:42:56

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 /*
0013   This class provides a history display.
0014 */
0015 
0016 class KCalcHistory : public QTextEdit
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit KCalcHistory(QWidget *parent = nullptr);
0022     ~KCalcHistory() override;
0023 
0024     void addToHistory(const QString &, bool);
0025     void addResultToHistory(const QString &);
0026     void addFuncToHistory(const QString &);
0027 
0028     void changeSettings();
0029     void setFont(const QFont &font);
0030     const QFont &baseFont() const;
0031 
0032 public Q_SLOTS:
0033     void clearHistory();
0034 
0035 protected:
0036     void resizeEvent(QResizeEvent* event) override;
0037 
0038 private:
0039     bool add_new_line_ = false;
0040     QFont baseFont_;
0041     double idealPointSizeF_;
0042     void updateFont(double zoomFactor = 1.0);
0043 };
0044 
0045 #endif