Removed Linestyle from the project

This commit is contained in:
2020-01-15 12:01:17 +01:00
parent c4467b70b8
commit af5a05faf8
4 changed files with 3 additions and 28 deletions

View File

@@ -4,8 +4,7 @@
IntelliToolsettings::IntelliToolsettings() IntelliToolsettings::IntelliToolsettings()
{ {
lineWidth = 1; lineWidth = 1;
innerAlpha = 255; innerAlpha = 255;
Linestyle = LineStyle::SOLID_LINE;
} }
IntelliToolsettings::~IntelliToolsettings(){ IntelliToolsettings::~IntelliToolsettings(){
@@ -47,7 +46,3 @@ void IntelliToolsettings::setInnerAlpha(int innerAlpha){
} }
this->innerAlpha = innerAlpha; this->innerAlpha = innerAlpha;
} }
IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){
return Linestyle;
}

View File

@@ -3,13 +3,6 @@
class IntelliToolsettings { class IntelliToolsettings {
public: public:
/*!
* \brief The LineStyle enum classifing all ways of drawing a line.
*/
enum class LineStyle {
SOLID_LINE,
DOTTED_LINE
};
IntelliToolsettings(); IntelliToolsettings();
virtual ~IntelliToolsettings(); virtual ~IntelliToolsettings();
int getLineWidth(); int getLineWidth();
@@ -18,12 +11,10 @@ void setLineWidth(int LineWidth);
int getInnerAlpha(); int getInnerAlpha();
void setInnerAlpha(); void setInnerAlpha();
void setInnerAlpha(int innerAlpha); void setInnerAlpha(int innerAlpha);
LineStyle getLinestyle();
private: private:
int lineWidth; int lineWidth;
int innerAlpha; int innerAlpha;
LineStyle Linestyle;
}; };
#endif #endif

View File

@@ -40,18 +40,7 @@ void IntelliToolLine::onMouseMoved(int x, int y){
if(this->isDrawing) { if(this->isDrawing) {
this->Canvas->image->drawPlain(Qt::transparent); this->Canvas->image->drawPlain(Qt::transparent);
QPoint next(x,y); QPoint next(x,y);
switch(Toolsettings->getLinestyle()) { this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
case IntelliToolsettings::LineStyle::SOLID_LINE:
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
break;
case IntelliToolsettings::LineStyle::DOTTED_LINE:
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
//TODO implement dotted algorithm
break;
}
} }
IntelliTool::onMouseMoved(x,y); IntelliTool::onMouseMoved(x,y);
} }

View File

@@ -16,7 +16,7 @@ QPoint lineStartingPoint;
public: public:
/*! /*!
* \brief A constructor setting the general paintingArea and colorPicker. And reading in the lineWidth and lineStyle. * \brief A constructor setting the general paintingArea and colorPicker.
* \param Area - The general paintingArea used by the project. * \param Area - The general paintingArea used by the project.
* \param colorPicker - The general colorPicker used by the project. * \param colorPicker - The general colorPicker used by the project.
*/ */