using qpen
This commit is contained in:
		| @@ -18,7 +18,7 @@ void RenderArea::paintEvent(QPaintEvent* event) | ||||
| 	painter.setRenderHint(QPainter::Antialiasing,true); | ||||
|  | ||||
| 	painter.setBrush(mBackgroundColour); | ||||
| 	painter.setPen(mShapeColour); | ||||
| 	painter.setPen(mPen); | ||||
|  | ||||
| 	painter.drawRect(this->rect()); | ||||
|  | ||||
| @@ -50,9 +50,10 @@ void RenderArea::paintEvent(QPaintEvent* event) | ||||
| RenderArea::RenderArea(QWidget *parent) : | ||||
| 	QWidget{parent}, | ||||
| 	mBackgroundColour{36,35,35}, | ||||
| 	mShapeColour{251,250,250}, | ||||
| 	mPen{QColor{251,250,250}}, | ||||
| 	mShape{Astroid} | ||||
| { | ||||
| 	mPen.setWidth(2); | ||||
| 	OnShapeChanged(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| #define RENDERAREA_H | ||||
|  | ||||
| #include <QWidget> | ||||
| #include <QPen> | ||||
|  | ||||
| class RenderArea : public QWidget | ||||
| { | ||||
| @@ -27,8 +28,8 @@ class RenderArea : public QWidget | ||||
| 		void setBackgroundColor(QColor color) { mBackgroundColour = color; } | ||||
| 		QColor backgroundColor() const { return mBackgroundColour; } | ||||
|  | ||||
| 		void setShapeColor(QColor color) { mShapeColour = color; } | ||||
| 		QColor shapeColor() const { return mShapeColour; } | ||||
| 		void setShapeColor(QColor color) { mPen.setColor(color); } | ||||
| 		QColor shapeColor() const { return mPen.color(); } | ||||
|  | ||||
| 		void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); } | ||||
| 		ShapesType shape() const { return mShape; } | ||||
| @@ -61,8 +62,9 @@ class RenderArea : public QWidget | ||||
| 		QPointF ComputeEllipse(double t); | ||||
| 		QPointF ComputeFancy(double t); | ||||
| 		QPointF ComputeStarfish(double t); | ||||
| 		QColor mBackgroundColour,mShapeColour; | ||||
| 		QColor mBackgroundColour; | ||||
| 		ShapesType mShape; | ||||
| 		QPen mPen; | ||||
| 		double mScale,mIntervalLenght; | ||||
| 		int mStepCount; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user