コード例 #1
0
ファイル: paniconwidget.cpp プロジェクト: rosedu/digikam
void PanIconWidget::regionSelectionMoved(bool targetDone)
{
    if (targetDone)
    {
        update();
    }

    int x = (int)lround( ((float)d->localRegionSelection.x() - (float)d->rect.x() ) *
                         ((float)d->zoomedOrgWidth / (float)d->width) );

    int y = (int)lround( ((float)d->localRegionSelection.y() - (float)d->rect.y() ) *
                         ((float)d->zoomedOrgHeight / (float)d->height) );

    int w = (int)lround( (float)d->localRegionSelection.width() *
                         ((float)d->zoomedOrgWidth / (float)d->width) );

    int h = (int)lround( (float)d->localRegionSelection.height() *
                         ((float)d->zoomedOrgHeight / (float)d->height) );

    d->regionSelection.setX(x);
    d->regionSelection.setY(y);
    d->regionSelection.setWidth(w);
    d->regionSelection.setHeight(h);

    emit signalSelectionMoved( d->regionSelection, targetDone );
}
コード例 #2
0
void PanIconWidget::regionSelectionMoved(bool targetDone)
{
    int x = (int)lround( ((float)m_localRegionSelection.x() /*- (float)m_rect.x()*/ ) *
                         ((float)m_orgWidth / (float)m_width) );

    int y = (int)lround( ((float)m_localRegionSelection.y() /*- (float)m_rect.y()*/ ) *
                         ((float)m_orgHeight / (float)m_height) );

    int w = (int)lround( (float)m_localRegionSelection.width() *
                         ((float)m_orgWidth / (float)m_width) );

    int h = (int)lround( (float)m_localRegionSelection.height() *
                         ((float)m_orgHeight / (float)m_height) );

    regionSelection.setX(x);
    regionSelection.setY(y);
    regionSelection.setWidth(w);
    regionSelection.setHeight(h);

    update();
    emit signalSelectionMoved( regionSelection, targetDone );
}