using qpen

This commit is contained in:
thepra 2017-09-09 22:41:29 +02:00
parent 3b0554cb87
commit c2bc58b2d7
2 changed files with 8 additions and 5 deletions

View File

@ -18,7 +18,7 @@ void RenderArea::paintEvent(QPaintEvent* event)
painter.setRenderHint(QPainter::Antialiasing,true); painter.setRenderHint(QPainter::Antialiasing,true);
painter.setBrush(mBackgroundColour); painter.setBrush(mBackgroundColour);
painter.setPen(mShapeColour); painter.setPen(mPen);
painter.drawRect(this->rect()); painter.drawRect(this->rect());
@ -50,9 +50,10 @@ void RenderArea::paintEvent(QPaintEvent* event)
RenderArea::RenderArea(QWidget *parent) : RenderArea::RenderArea(QWidget *parent) :
QWidget{parent}, QWidget{parent},
mBackgroundColour{36,35,35}, mBackgroundColour{36,35,35},
mShapeColour{251,250,250}, mPen{QColor{251,250,250}},
mShape{Astroid} mShape{Astroid}
{ {
mPen.setWidth(2);
OnShapeChanged(); OnShapeChanged();
} }

View File

@ -2,6 +2,7 @@
#define RENDERAREA_H #define RENDERAREA_H
#include <QWidget> #include <QWidget>
#include <QPen>
class RenderArea : public QWidget class RenderArea : public QWidget
{ {
@ -27,8 +28,8 @@ class RenderArea : public QWidget
void setBackgroundColor(QColor color) { mBackgroundColour = color; } void setBackgroundColor(QColor color) { mBackgroundColour = color; }
QColor backgroundColor() const { return mBackgroundColour; } QColor backgroundColor() const { return mBackgroundColour; }
void setShapeColor(QColor color) { mShapeColour = color; } void setShapeColor(QColor color) { mPen.setColor(color); }
QColor shapeColor() const { return mShapeColour; } QColor shapeColor() const { return mPen.color(); }
void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); } void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); }
ShapesType shape() const { return mShape; } ShapesType shape() const { return mShape; }
@ -61,8 +62,9 @@ class RenderArea : public QWidget
QPointF ComputeEllipse(double t); QPointF ComputeEllipse(double t);
QPointF ComputeFancy(double t); QPointF ComputeFancy(double t);
QPointF ComputeStarfish(double t); QPointF ComputeStarfish(double t);
QColor mBackgroundColour,mShapeColour; QColor mBackgroundColour;
ShapesType mShape; ShapesType mShape;
QPen mPen;
double mScale,mIntervalLenght; double mScale,mIntervalLenght;
int mStepCount; int mStepCount;
}; };