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 47 48 49 50 51 52 53 54 55 56 57
|
/*
* SPDX-FileCopyrightText: 2024 Eugene Popov <popov895@ukr.net>
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KCALCNUMERALSYSTEMVIEW_H
#define KCALCNUMERALSYSTEMVIEW_H
#include <QWidget>
class QLabel;
class KSqueezedTextLabel;
// KCalcNumeralSystemLabel
class KCalcNumeralSystemLabel : public QWidget
{
Q_OBJECT
public:
explicit KCalcNumeralSystemLabel(QWidget *parent = nullptr);
void setNumber(quint64 number, int base);
protected:
void changeEvent(QEvent *event) override;
private:
void updateAlignment();
KSqueezedTextLabel *m_textLabel;
QLabel *m_numeralSystemLabel;
};
// KCalcNumeralSystemView
class KCalcNumeralSystemView : public QWidget
{
Q_OBJECT
public:
explicit KCalcNumeralSystemView(QWidget *parent = nullptr);
void setNumber(quint64 number, int base);
void clearNumber();
private:
void updateLabels();
KCalcNumeralSystemLabel *m_label1 = nullptr;
KCalcNumeralSystemLabel *m_label2 = nullptr;
KCalcNumeralSystemLabel *m_label3 = nullptr;
std::optional<quint64> m_number;
int m_base = 10;
};
#endif // KCALCNUMERALSYSTEMVIEW_H
|