Esempio n. 1
0
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);
    }
}
Esempio n. 2
0
void EraserInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        mEndPoint = event->pos();
        paint(imageArea);
        imageArea.setIsPaint(false);
    }
}
Esempio n. 3
0
void EraserInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        mEndPoint = event->pos();
        paint(imageArea, false);
        mStartPoint = event->pos();
    }
}
Esempio n. 4
0
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);
    }
}
Esempio n. 5
0
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);
    }
}
Esempio n. 6
0
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);
        }
    }
}