File indexing completed on 2024-04-21 03:41:49

0001 /*
0002     RationalWidget.h  -  paint a rational number
0003     SPDX-FileCopyrightText: 2004 Sebastian Stein <seb.kde@hpfsc.de>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef RATIONALWIDGET_H
0009 #define RATIONALWIDGET_H
0010 
0011 #include "FractionBaseWidget.h"
0012 
0013 class QPaintEvent;
0014 
0015 /*! class to paint a rational number
0016  *
0017  *  \author Sebastian Stein */
0018 class RationalWidget : public FractionBaseWidget
0019 {
0020     Q_OBJECT
0021 public:
0022     /** constructor */
0023     RationalWidget(QWidget * parent, const QString &pnumber, const int pperiodStart = 1, const int pperiodLength = 0);
0024 
0025     /** destructor */
0026     ~RationalWidget() override;
0027 
0028     /** set the task to be displayed */
0029     void setRational(const QString &pnumber, const int pperiodStart = 1, const int pperiodLength = 0);
0030 
0031 private:
0032 
0033     /** the rational number to be displayed */
0034     QString m_number;
0035 
0036     /** starting of the period */
0037     int m_periodStart;
0038 
0039     /** length of the period */
0040     int m_periodLength;
0041 
0042     /** overriding the paint event of FractionBaseWidget */
0043     void paintEvent(QPaintEvent*) override;
0044 };
0045 
0046 #endif