QtCurvesCpp/renderarea.h

50 lines
1.1 KiB
C
Raw Normal View History

2017-08-28 10:07:22 +02:00
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
class RenderArea : public QWidget
{
Q_OBJECT
public:
explicit RenderArea(QWidget *parent = nullptr);
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
2017-08-28 11:07:50 +02:00
enum ShapesType{
Astroid,
Cycloid,
HuygensCycloid,
2017-08-28 13:08:42 +02:00
HypoCycloid,
Line
2017-08-28 11:07:50 +02:00
};
void setBackgroundColor(QColor color) { mBackgroundColour = color; }
QColor backgroundColor() const { return mBackgroundColour; }
2017-08-28 12:32:05 +02:00
void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); }
2017-08-28 11:07:50 +02:00
ShapesType shape() const { return mShape; }
2017-08-28 10:07:22 +02:00
signals:
protected:
void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
public slots:
private:
2017-08-28 12:32:05 +02:00
void OnShapeChanged();
QPointF ComputeAstroid(double t);
QPointF ComputeCycloid(double t);
QPointF ComputeHuygens(double t);
QPointF ComputeHypo(double t);
2017-08-28 13:08:42 +02:00
QPointF ComputeLine(double t);
2017-08-28 12:32:05 +02:00
QPointF Compute(double t);
QColor mBackgroundColour,mShapeColour;
2017-08-28 11:07:50 +02:00
ShapesType mShape;
2017-08-28 12:32:05 +02:00
double mScale,mIntervalLenght;
int mStepCount;
2017-08-28 10:07:22 +02:00
};
#endif // RENDERAREA_H