File indexing completed on 2024-03-24 03:44:33

0001 /*
0002     RatioWidget.h  -  paint a ratio
0003     SPDX-FileCopyrightText: 2004 Sebastian Stein <seb.kde@hpfsc.de>
0004     SPDX-FileCopyrightText: 2008 Tadeu Araujo <tadeu.araujo@ltia.fc.unesp.br>
0005     SPDX-FileCopyrightText: 2008 Danilo Balzaque <danilo.balzaque@ltia.fc.unesp.br>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef RATIOWIDGET_H
0011 #define RATIOWIDGET_H
0012 
0013 #include "FractionBaseWidget.h"
0014 #include "Ratio.h"
0015 
0016 #include <QWidget>
0017 
0018 class QPaintEvent;
0019 
0020 /*! class to paint the ratio
0021  *
0022  *  \author Sebastian Stein */
0023 class RatioWidget : public FractionBaseWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     /** constructor */
0028     explicit RatioWidget(QWidget * parent = nullptr, const Ratio &para_ratio = Ratio());
0029 
0030     /** destructor */
0031     ~RatioWidget() override;
0032 
0033     /** set the task to be displayed */
0034     void setRatio(const Ratio &para_ratio);
0035 
0036     void setQuestionMixed(bool value);
0037 
0038 private:
0039 
0040     /** the ratio to be displayed */
0041     Ratio m_ratio;
0042 
0043     /*identify if the fraction will appear in mixed form or not*/
0044     bool m_questionMixed;
0045 
0046     /** overriding the paint event of FractionBaseWidget */
0047     void paintEvent(QPaintEvent*) override;
0048 };
0049 
0050 #endif