using qpen
This commit is contained in:
		@@ -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();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user