コード例 #1
0
void PanIconWidget::mouseReleaseEvent ( QMouseEvent * )
{
    if ( moveSelection )
    {
        moveSelection = false;
        QApplication::restoreOverrideCursor();
        regionSelectionMoved(true);
    }
}
コード例 #2
0
ファイル: paniconwidget.cpp プロジェクト: rosedu/digikam
void PanIconWidget::mouseReleaseEvent ( QMouseEvent* )
{
    if ( d->moveSelection )
    {
        d->moveSelection = false;
        setCursor( Qt::ArrowCursor );
        regionSelectionMoved(true);
    }
}
コード例 #3
0
ファイル: paniconwidget.cpp プロジェクト: rosedu/digikam
void PanIconWidget::mouseMoveEvent ( QMouseEvent* e )
{
    if ( d->moveSelection &&
            (e->buttons() == Qt::LeftButton || e->buttons() == Qt::MidButton) )
    {
        int newxpos = e->x();
        int newypos = e->y();

        d->localRegionSelection.translate(newxpos - d->xpos, newypos - d->ypos);

        d->xpos = newxpos;
        d->ypos = newypos;

        // Perform normalization of selection area.

        if (d->localRegionSelection.left() < d->rect.left())
        {
            d->localRegionSelection.moveLeft(d->rect.left());
        }

        if (d->localRegionSelection.top() < d->rect.top())
        {
            d->localRegionSelection.moveTop(d->rect.top());
        }

        if (d->localRegionSelection.right() > d->rect.right())
        {
            d->localRegionSelection.moveRight(d->rect.right());
        }

        if (d->localRegionSelection.bottom() > d->rect.bottom())
        {
            d->localRegionSelection.moveBottom(d->rect.bottom());
        }

        update();
        regionSelectionMoved(false);
        return;
    }
    else
    {
        if ( d->localRegionSelection.contains( e->x(), e->y() ) )
        {
            setCursor( Qt::PointingHandCursor );
        }
        else
        {
            setCursor( Qt::ArrowCursor );
        }
    }
}
コード例 #4
0
void PanIconWidget::mouseMoveEvent ( QMouseEvent * e )
{
    if ( moveSelection && 
         (e->buttons() == Qt::LeftButton || e->buttons() == Qt::MidButton) )
    {
        int newxpos = e->x();
        int newypos = e->y();

        m_localRegionSelection.translate(newxpos - xpos, newypos - ypos);

        xpos = newxpos;
        ypos = newypos;

        // Perform normalization of selection area.

        if (m_localRegionSelection.left() < /*m_rect.left()*/0)
            m_localRegionSelection.moveLeft(/*m_rect.left()*/0);

        if (m_localRegionSelection.top() < /*m_rect.top()*/0)
            m_localRegionSelection.moveTop(/*m_rect.top()*/0);

        if (m_localRegionSelection.right() > /*m_rect.right()*/width())
            m_localRegionSelection.moveRight(/*m_rect.right()*/width());

        if (m_localRegionSelection.bottom() > /*m_rect.bottom()*/height())
            m_localRegionSelection.moveBottom(/*m_rect.bottom()*/height());

        update();
        regionSelectionMoved(false);
        return;
    }
    else 
    {
        if ( m_localRegionSelection.contains( e->x(), e->y() ) )
            QApplication::setOverrideCursor( QCursor(Qt::PointingHandCursor));
        else
            QApplication::restoreOverrideCursor();
    }
}