QtCurvesCpp/renderarea.h

48 lines
1.0 KiB
C++

#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;
enum ShapesType{
Astroid,
Cycloid,
HuygensCycloid,
HypoCycloid
};
void setBackgroundColor(QColor color) { mBackgroundColour = color; }
QColor backgroundColor() const { return mBackgroundColour; }
void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); }
ShapesType shape() const { return mShape; }
signals:
protected:
void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
public slots:
private:
void OnShapeChanged();
QPointF ComputeAstroid(double t);
QPointF ComputeCycloid(double t);
QPointF ComputeHuygens(double t);
QPointF ComputeHypo(double t);
QPointF Compute(double t);
QColor mBackgroundColour,mShapeColour;
ShapesType mShape;
double mScale,mIntervalLenght;
int mStepCount;
};
#endif // RENDERAREA_H