Exemple #1
0
void AbstractSelection::updateCursor(QMouseEvent *event, ImageArea &imageArea)
{
    if (mIsSelectionExists)
    {
        if (event->pos().x() > mTopLeftPoint.x() &&
            event->pos().x() < mBottomRightPoint.x() &&
            event->pos().y() > mTopLeftPoint.y() &&
            event->pos().y() < mBottomRightPoint.y())
        { 
            imageArea.setCursor(Qt::SizeAllCursor);
        }
        else if (event->pos().x() >= mBottomRightPoint.x() &&
                 event->pos().x() <= mBottomRightPoint.x() + 6 &&
                 event->pos().y() >= mBottomRightPoint.y() &&
                 event->pos().y() <= mBottomRightPoint.y() + 6)
        {
            imageArea.setCursor(Qt::SizeFDiagCursor);
        }
        else
        {
            imageArea.restoreCursor();
        }
    }
    else
    {
        imageArea.restoreCursor();
    }
}
Exemple #2
0
void AbstractSelection::clearSelection(ImageArea &imageArea)
{
    if (mIsSelectionExists)
    {
        imageArea.setImage(mImageCopy);
        paint(imageArea);
        mImageCopy = *imageArea.getImage();
        mIsSelectionExists = mIsSelectionMoving = mIsSelectionResizing
                = mIsPaint = mIsImageSelected = false;
        imageArea.update(); 
        imageArea.restoreCursor();
        clear();
    }
}