Image adjustment after cropping

Dmitry Kazakov dimula73 at
Thu Jan 31 08:21:44 UTC 2013

> m_d->zoomManager->zoomController()->resetToFixedZoom();
>> m_d->canvasController->setPreferredCenter(;
>> m_d->canvasController->recenterPreferred()
This approach works somewhat ok, but it is needed to investigate how to
calculate value. If we do it in a straightforward
way, like QPointF(widgetSize.height()/2, widgetSize.height()/2), then it
works like that:

1) When the image is heavily zoomed in, that is "documentOrigin" == 0, the
cropped area is put somewhere near to the center (not exactly, though).
2) When the image is zoomed out, origin != 0, then the image jumps to the
topleft corner o fthe widget.

I think we just need to recall how the value of the preferred center is
calculated (i would use that unittest) and calculate that properly here.

Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kimageshop mailing list