void CurveLineInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { switch(mPointsCount) { //draw linear Bezier curve case 1: mEndPoint = event->pos(); break; //draw square Bezier curve case 2: mFirstControlPoint = mSecondControlPoint = event->pos(); break; //draw cubic Bezier curve case 0: mSecondControlPoint = event->pos(); break; } imageArea.setImage(mImageCopy); if(event->buttons() & Qt::LeftButton) paint(imageArea, false); else if(event->buttons() & Qt::RightButton) paint(imageArea, true); } }
void EraserInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { mEndPoint = event->pos(); paint(imageArea); imageArea.setIsPaint(false); } }
void EraserInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { mEndPoint = event->pos(); paint(imageArea, false); mStartPoint = event->pos(); } }
void CurveLineInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { imageArea.setImage(mImageCopy); if(event->button() == Qt::LeftButton) paint(imageArea, false); else if(event->button() == Qt::RightButton) paint(imageArea, true); imageArea.setIsPaint(false); } }
void FillInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { if(event->button() == Qt::LeftButton) { paint(imageArea, false); } else if(event->button() == Qt::RightButton) { paint(imageArea, true); } imageArea.setIsPaint(false); } }
void LineInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { mEndPoint = event->pos(); imageArea.setImage(mImageCopy); if(event->buttons() & Qt::LeftButton) { paint(imageArea, false); } else if(event->buttons() & Qt::RightButton) { paint(imageArea, true); } } }