File indexing completed on 2022-12-06 18:52:31

0001 /*
0002     SPDX-FileCopyrightText: 2008 Danilo Balzaque <danilo.balzaque@ltia.fc.unesp.br>
0003     SPDX-FileCopyrightText: 2008 Tadeu Araujo <tadeu.araujo@ltia.fc.unesp.br>
0004     SPDX-FileCopyrightText: 2008 Tiago Porangaba <tiago.porangaba@ltia.fc.unesp.br>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef FRACTIONPAINTER_H
0010 #define FRACTIONPAINTER_H
0011 
0012 #include "Ratio.h"
0013 #include "RatioWidget.h"
0014 
0015 #include <QWidget>
0016 
0017 class QPainter;
0018 class QPaintEvent;
0019 
0020 /*! Constructs a QWidget bla bla bla
0021  *  \author Danilo Balzaque
0022  * */
0023 class FractionPainter : public FractionBaseWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     /** constructor */
0028     explicit FractionPainter(QWidget * parent = nullptr);
0029 
0030     /** destructor */
0031     ~FractionPainter() override;
0032 
0033     void paintFraction(const QString & str_operation, Ratio & leftRatio, int leftMult,
0034                        Ratio & rightRatio, int rightMult);
0035     void update();
0036 protected:
0037     /** Function is called every time the screen need to be painted.
0038      **/
0039     void paintEvent(QPaintEvent * event) override;
0040     void paintWidget(QPainter & paint);
0041 
0042 private:
0043     QString str_operation;
0044     Ratio leftRatio;
0045     int leftMult;
0046     Ratio rightRatio;
0047     int rightMult;
0048 };
0049 
0050 #endif